﻿Imports System.Data.SqlClient
Imports System.Data.Odbc

Public Class frmInformeEconomico
    Dim xl As Object
    Dim wb As Object
    Private Sub frmInformeEconomico_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ToolStrip1.Cursor = Cursors.Hand
        ToolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System

        txtEjercicio.Text = Now.Year
        lblStatus.Text = "Seleccione el periodo y ejercicio a procesar..."

    End Sub
    Sub CreaArchivoExcel()
        xl = CreateObject("Excel.Application")
        xl.Visible = True
        xl.Workbooks.Add()
    End Sub

    Sub AjustaRangoCelda(ByVal Hoja As Integer, ByVal Rango As String)
        wb.SHEETS(Hoja).Range(Rango).HorizontalAlignment = -4108
        wb.SHEETS(Hoja).Range(Rango).VerticalAlignment = -4108
        wb.SHEETS(Hoja).Range(Rango).WrapText = False
        wb.SHEETS(Hoja).Range(Rango).Orientation = 0
        wb.SHEETS(Hoja).Range(Rango).AddIndent = False
        wb.SHEETS(Hoja).Range(Rango).IndentLevel = 0
        wb.SHEETS(Hoja).Range(Rango).ShrinkToFit = False
        wb.SHEETS(Hoja).Range(Rango).ReadingOrder = -5002
        wb.SHEETS(Hoja).Range(Rango).MergeCells = True
        wb.SHEETS(Hoja).Range(Rango).Merge()
        wb.SHEETS(Hoja).Range(Rango).INTERIOR.ThemeColor = 1
        wb.SHEETS(Hoja).Range(Rango).INTERIOR.TintAndShade = -0.149998474074526
    End Sub
    Sub ResultadosEmpresa()
        Dim rng As Integer = 2

        wb.SHEETS(7).select()
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        wb.SHEETS(8).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(8).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(8).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(8).cells(1, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(8).cells(1, 2).FONT.SIZE = 14
        wb.SHEETS(8).cells(rng, 2).value = "Autobuses Urbanos y Suburbanos de Leon SA de CV"
        wb.SHEETS(8).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(8).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(8).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(8).cells(rng, 2).value = "Estado de Resultados por Empresa"
        rng = rng + 2

        'AGREGA DEFINICIONES
        wb.SHEETS(8).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(8).cells(rng, 3).value = "ENERO"
        wb.SHEETS(8).cells(rng, 4).value = "FEBRERO"
        wb.SHEETS(8).cells(rng, 5).value = "MARZO"
        wb.SHEETS(8).cells(rng, 6).value = "ABRIL"
        wb.SHEETS(8).cells(rng, 7).value = "MAYO"
        wb.SHEETS(8).cells(rng, 8).value = "JUNIO"
        wb.SHEETS(8).cells(rng, 9).value = "JULIO"
        wb.SHEETS(8).cells(rng, 10).value = "AGOSTO"
        wb.SHEETS(8).cells(rng, 11).value = "SEPTIEMBRE"
        wb.SHEETS(8).cells(rng, 12).value = "OCTUBRE"
        wb.SHEETS(8).cells(rng, 13).value = "NOVIEMBRE"
        wb.SHEETS(8).cells(rng, 14).value = "DICIEMBRE"
        wb.SHEETS(8).cells(rng, 15).value = "ACUMULADO"

        For I = 2 To 15
            wb.SHEETS(8).cells(rng, I).font.bold = True
            wb.SHEETS(8).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(8).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(8).CELLS(rng, I).WrapText = True
            wb.SHEETS(8).CELLS(rng, I).Orientation = 0
            wb.SHEETS(8).CELLS(rng, I).AddIndent = False
            wb.SHEETS(8).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(8).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(8).CELLS(rng, I).MergeCells = False
            wb.SHEETS(8).CELLS(rng, I).ReadingOrder = -5002
        Next

        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(8).cells(9, 2).value = "Ingresos Boletos de Abordo"
        wb.SHEETS(8).cells(10, 2).value = "Ingresos Pagobus"
        wb.SHEETS(8).cells(11, 2).value = "Ingresos Red Integral Optibus"
        wb.SHEETS(8).cells(12, 2).value = "Otros Ingresos"
        wb.SHEETS(8).cells(13, 2).value = "Servicios Especiales"
        wb.SHEETS(8).cells(15, 2).value = "Total de Ingresos"


        wb.SHEETS(8).Range("C15:O15").INTERIOR.ThemeColor = 1
        wb.SHEETS(8).Range("C15:O15").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(8).Range("C26:O26").INTERIOR.ThemeColor = 1
        wb.SHEETS(8).Range("C26:O26").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(8).Range("C37:O37").INTERIOR.ThemeColor = 1
        wb.SHEETS(8).Range("C37:O37").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(8).Range("C57:O57").INTERIOR.ThemeColor = 1
        wb.SHEETS(8).Range("C57:O57").INTERIOR.TintAndShade = -0.0499893185216834

        wb.SHEETS(8).Range("C28:O28").INTERIOR.ThemeColor = 1
        wb.SHEETS(8).Range("C28:O28").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(8).Range("C39:O39").INTERIOR.ThemeColor = 1
        wb.SHEETS(8).Range("C39:O39").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(8).Range("C44:O44").INTERIOR.ThemeColor = 1
        wb.SHEETS(8).Range("C44:O44").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(8).Range("C59:O59").INTERIOR.ThemeColor = 1
        wb.SHEETS(8).Range("C59:O59").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(8).Range("C61:O61").INTERIOR.ThemeColor = 1
        wb.SHEETS(8).Range("C61:O61").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(8).Range("C63:O63").INTERIOR.ThemeColor = 1
        wb.SHEETS(8).Range("C63:O63").INTERIOR.TintAndShade = -0.149998474074526

        wb.SHEETS(8).cells(17, 2).value = "COSTOS DIRECTOS"
        wb.SHEETS(8).cells(18, 2).value = "Diesel"
        wb.SHEETS(8).cells(19, 2).value = "Sueldos y Salarios"
        wb.SHEETS(8).cells(20, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(8).cells(21, 2).value = "Refacciones"
        wb.SHEETS(8).cells(22, 2).value = "Mantenimiento y Reparación de Autobuses"
        wb.SHEETS(8).cells(23, 2).value = "Llantas Nuevas"
        wb.SHEETS(8).cells(24, 2).value = "Llantas Vitalizadas"
        wb.SHEETS(8).cells(26, 2).value = "Total de Costos Directos"

        wb.SHEETS(8).cells(28, 2).value = "UTILIDAD BRUTA"

        wb.SHEETS(8).cells(30, 2).value = "COSTOS INDIRECTOS DE OPERACIÓN"
        wb.SHEETS(8).cells(31, 2).value = "Gastos de Mantenimiento"
        wb.SHEETS(8).cells(32, 2).value = "Gastos de Operación y Servicios"
        wb.SHEETS(8).cells(33, 2).value = "Gastos de Seguro Interno"
        wb.SHEETS(8).cells(34, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(8).cells(35, 2).value = "Gastos Diversos de Operación"
        wb.SHEETS(8).cells(37, 2).value = "Total de Costos Indirectos"

        wb.SHEETS(8).cells(39, 2).value = "UTILIDAD MARGINAL"

        wb.SHEETS(8).cells(41, 2).value = "COSTOS INDIRECTOS DE ADMINISTRACIÓN"
        wb.SHEETS(8).cells(42, 2).value = "Gastos de Administración"

        wb.SHEETS(8).cells(44, 2).value = "UTILIDAD ANTES DE RESERVAS"

        wb.SHEETS(8).cells(46, 2).value = "RESERVAS"
        wb.SHEETS(8).cells(47, 2).value = "Reserva para Aguinaldo"
        wb.SHEETS(8).cells(48, 2).value = "Reserva para Tenencias y Refrendos"
        wb.SHEETS(8).cells(49, 2).value = "Reserva para Prima de Seguros"
        wb.SHEETS(8).cells(50, 2).value = "Fondo para Renovación de Equipo"
        wb.SHEETS(8).cells(51, 2).value = "Aportaciones al Fideicomiso"
        wb.SHEETS(8).cells(52, 2).value = "Reserva para Capacitación Adiestramiento Seguridad e Higiene y Otros"
        wb.SHEETS(8).cells(53, 2).value = "Reserva  PTU"
        wb.SHEETS(8).cells(54, 2).value = "Reserva para Uniformes y Otros Gastos Mayores"
        wb.SHEETS(8).cells(55, 2).value = "Reserva para Adquisición de Activos"

        wb.SHEETS(8).cells(57, 2).value = "Total de Reservas"

        wb.SHEETS(8).cells(59, 2).value = "RESULTADO ANTES DE DOCUMENTOS"
        wb.SHEETS(8).cells(60, 2).value = "Documento de Unidades"
        wb.SHEETS(8).cells(61, 2).value = "RESULTADO ANTES IMPUESTOS"
        wb.SHEETS(8).cells(62, 2).value = "Impuesto Sobre la Renta"
        wb.SHEETS(8).cells(63, 2).value = "RESULTADO NETO"

        For i = 9 To 63
            wb.SHEETS(8).cells(i, 15).value = "=SUMA(C" & i & ":N" & i & ")"
        Next
        wb.SHEETS(8).cells(16, 15).value = ""
        wb.SHEETS(8).cells(27, 15).value = ""
        wb.SHEETS(8).cells(29, 15).value = ""
        wb.SHEETS(8).cells(38, 15).value = ""
        wb.SHEETS(8).cells(40, 15).value = ""
        wb.SHEETS(8).cells(43, 15).value = ""
        wb.SHEETS(8).cells(45, 15).value = ""
        wb.SHEETS(8).cells(56, 15).value = ""
        wb.SHEETS(8).cells(58, 15).value = ""
        wb.SHEETS(8).cells(17, 15).value = ""
        wb.SHEETS(8).cells(30, 15).value = ""
        wb.SHEETS(8).cells(41, 15).value = ""
        wb.SHEETS(8).cells(46, 15).value = ""
        wb.SHEETS(8).cells(14, 15).value = ""
        wb.SHEETS(8).cells(25, 15).value = ""
        wb.SHEETS(8).cells(36, 15).value = ""

        wb.SHEETS(8).cells(15, 3).value = "=SUMA(C9:C14)"
        wb.SHEETS(8).cells(15, 4).value = "=SUMA(D9:D14)"
        wb.SHEETS(8).cells(15, 5).value = "=SUMA(E9:E14)"
        wb.SHEETS(8).cells(15, 6).value = "=SUMA(F9:F14)"
        wb.SHEETS(8).cells(15, 7).value = "=SUMA(G9:G14)"
        wb.SHEETS(8).cells(15, 8).value = "=SUMA(H9:H14)"
        wb.SHEETS(8).cells(15, 9).value = "=SUMA(I9:I14)"
        wb.SHEETS(8).cells(15, 10).value = "=SUMA(J9:J14)"
        wb.SHEETS(8).cells(15, 11).value = "=SUMA(K9:K14)"
        wb.SHEETS(8).cells(15, 12).value = "=SUMA(L9:L14)"
        wb.SHEETS(8).cells(15, 13).value = "=SUMA(M9:M14)"
        wb.SHEETS(8).cells(15, 14).value = "=SUMA(N9:N14)"
        wb.SHEETS(8).cells(15, 15).value = "=SUMA(O9:O14)"



        wb.SHEETS(8).cells(26, 3).value = "=SUMA(C18:C25)"
        wb.SHEETS(8).cells(26, 4).value = "=SUMA(D18:D25)"
        wb.SHEETS(8).cells(26, 5).value = "=SUMA(E18:E25)"
        wb.SHEETS(8).cells(26, 6).value = "=SUMA(F18:F25)"
        wb.SHEETS(8).cells(26, 7).value = "=SUMA(G18:G25)"
        wb.SHEETS(8).cells(26, 8).value = "=SUMA(H18:H25)"
        wb.SHEETS(8).cells(26, 9).value = "=SUMA(I18:I25)"
        wb.SHEETS(8).cells(26, 10).value = "=SUMA(J18:J25)"
        wb.SHEETS(8).cells(26, 11).value = "=SUMA(K18:K25)"
        wb.SHEETS(8).cells(26, 12).value = "=SUMA(L18:L25)"
        wb.SHEETS(8).cells(26, 13).value = "=SUMA(M18:M25)"
        wb.SHEETS(8).cells(26, 14).value = "=SUMA(N18:N25)"
        wb.SHEETS(8).cells(26, 15).value = "=SUMA(O18:O25)"

        wb.SHEETS(8).cells(28, 3).value = "=C15-C26"
        wb.SHEETS(8).cells(28, 4).value = "=D15-D26"
        wb.SHEETS(8).cells(28, 5).value = "=E15-E26"
        wb.SHEETS(8).cells(28, 6).value = "=F15-F26"
        wb.SHEETS(8).cells(28, 7).value = "=G15-G26"
        wb.SHEETS(8).cells(28, 8).value = "=H15-H26"
        wb.SHEETS(8).cells(28, 9).value = "=I15-I26"
        wb.SHEETS(8).cells(28, 10).value = "=J15-J26"
        wb.SHEETS(8).cells(28, 11).value = "=K15-K26"
        wb.SHEETS(8).cells(28, 12).value = "=L15-L26"
        wb.SHEETS(8).cells(28, 13).value = "=M15-M26"
        wb.SHEETS(8).cells(28, 14).value = "=N15-N26"
        wb.SHEETS(8).cells(28, 15).value = "=O15-O26"

        wb.SHEETS(8).cells(37, 3).value = "=SUMA(C31:C36)"
        wb.SHEETS(8).cells(37, 4).value = "=SUMA(D31:D36)"
        wb.SHEETS(8).cells(37, 5).value = "=SUMA(E31:E36)"
        wb.SHEETS(8).cells(37, 6).value = "=SUMA(F31:F36)"
        wb.SHEETS(8).cells(37, 7).value = "=SUMA(G31:G36)"
        wb.SHEETS(8).cells(37, 8).value = "=SUMA(H31:H36)"
        wb.SHEETS(8).cells(37, 9).value = "=SUMA(I31:I36)"
        wb.SHEETS(8).cells(37, 10).value = "=SUMA(J31:J36)"
        wb.SHEETS(8).cells(37, 11).value = "=SUMA(K31:K36)"
        wb.SHEETS(8).cells(37, 12).value = "=SUMA(L18:L36)"
        wb.SHEETS(8).cells(37, 13).value = "=SUMA(M31:M36)"
        wb.SHEETS(8).cells(37, 14).value = "=SUMA(N31:N36)"
        wb.SHEETS(8).cells(37, 15).value = "=SUMA(O31:O36)"

        wb.SHEETS(8).cells(39, 3).value = "=C28-C37"
        wb.SHEETS(8).cells(39, 4).value = "=D28-D37"
        wb.SHEETS(8).cells(39, 5).value = "=E28-E37"
        wb.SHEETS(8).cells(39, 6).value = "=F28-F37"
        wb.SHEETS(8).cells(39, 7).value = "=G28-G37"
        wb.SHEETS(8).cells(39, 8).value = "=H28-H37"
        wb.SHEETS(8).cells(39, 9).value = "=I28-I37"
        wb.SHEETS(8).cells(39, 10).value = "=J28-J37"
        wb.SHEETS(8).cells(39, 11).value = "=K28-K37"
        wb.SHEETS(8).cells(39, 12).value = "=L28-L37"
        wb.SHEETS(8).cells(39, 13).value = "=M28-M37"
        wb.SHEETS(8).cells(39, 14).value = "=N28-N37"
        wb.SHEETS(8).cells(39, 15).value = "=O28-O37"

        wb.SHEETS(8).cells(44, 3).value = "=C39-C42"
        wb.SHEETS(8).cells(44, 4).value = "=D39-D42"
        wb.SHEETS(8).cells(44, 5).value = "=E39-E42"
        wb.SHEETS(8).cells(44, 6).value = "=F39-F42"
        wb.SHEETS(8).cells(44, 7).value = "=G39-G42"
        wb.SHEETS(8).cells(44, 8).value = "=H39-H42"
        wb.SHEETS(8).cells(44, 9).value = "=I39-I42"
        wb.SHEETS(8).cells(44, 10).value = "=J39-J42"
        wb.SHEETS(8).cells(44, 11).value = "=K39-K42"
        wb.SHEETS(8).cells(44, 12).value = "=L39-L42"
        wb.SHEETS(8).cells(44, 13).value = "=M39-M42"
        wb.SHEETS(8).cells(44, 14).value = "=N39-N42"
        wb.SHEETS(8).cells(44, 15).value = "=O39-O42"

        wb.SHEETS(8).cells(57, 3).value = "=SUMA(C47:C56)"
        wb.SHEETS(8).cells(57, 4).value = "=SUMA(D47:D56)"
        wb.SHEETS(8).cells(57, 5).value = "=SUMA(E47:E56)"
        wb.SHEETS(8).cells(57, 6).value = "=SUMA(F47:F56)"
        wb.SHEETS(8).cells(57, 7).value = "=SUMA(G47:G56)"
        wb.SHEETS(8).cells(57, 8).value = "=SUMA(H47:H56)"
        wb.SHEETS(8).cells(57, 9).value = "=SUMA(I47:I56)"
        wb.SHEETS(8).cells(57, 10).value = "=SUMA(J47:J56)"
        wb.SHEETS(8).cells(57, 11).value = "=SUMA(K47:K56)"
        wb.SHEETS(8).cells(57, 12).value = "=SUMA(L47:L56)"
        wb.SHEETS(8).cells(57, 13).value = "=SUMA(M47:M56)"
        wb.SHEETS(8).cells(57, 14).value = "=SUMA(N47:N56)"
        wb.SHEETS(8).cells(57, 15).value = "=SUMA(O47:O56)"

        wb.SHEETS(8).cells(59, 3).value = "=C44-C57"
        wb.SHEETS(8).cells(59, 4).value = "=D44-D57"
        wb.SHEETS(8).cells(59, 5).value = "=E44-E57"
        wb.SHEETS(8).cells(59, 6).value = "=F44-F57"
        wb.SHEETS(8).cells(59, 7).value = "=G44-G57"
        wb.SHEETS(8).cells(59, 8).value = "=H44-H57"
        wb.SHEETS(8).cells(59, 9).value = "=I44-I57"
        wb.SHEETS(8).cells(59, 10).value = "=J44-J57"
        wb.SHEETS(8).cells(59, 11).value = "=K44-K57"
        wb.SHEETS(8).cells(59, 12).value = "=L44-L57"
        wb.SHEETS(8).cells(59, 13).value = "=M44-M57"
        wb.SHEETS(8).cells(59, 14).value = "=N44-N57"
        wb.SHEETS(8).cells(59, 15).value = "=O44-O57"

        wb.SHEETS(8).cells(61, 3).value = "=C59-C60"
        wb.SHEETS(8).cells(61, 4).value = "=D59-D60"
        wb.SHEETS(8).cells(61, 5).value = "=E59-E60"
        wb.SHEETS(8).cells(61, 6).value = "=F59-F60"
        wb.SHEETS(8).cells(61, 7).value = "=G59-G60"
        wb.SHEETS(8).cells(61, 8).value = "=H59-H60"
        wb.SHEETS(8).cells(61, 9).value = "=I59-I60"
        wb.SHEETS(8).cells(61, 10).value = "=J59-J60"
        wb.SHEETS(8).cells(61, 11).value = "=K59-K60"
        wb.SHEETS(8).cells(61, 12).value = "=L59-L60"
        wb.SHEETS(8).cells(61, 13).value = "=M59-M60"
        wb.SHEETS(8).cells(61, 14).value = "=N59-N60"
        wb.SHEETS(8).cells(61, 15).value = "=O59-O60"

        wb.SHEETS(8).cells(63, 3).value = "=C61-C62"
        wb.SHEETS(8).cells(63, 4).value = "=D61-D62"
        wb.SHEETS(8).cells(63, 5).value = "=E61-E62"
        wb.SHEETS(8).cells(63, 6).value = "=F61-F62"
        wb.SHEETS(8).cells(63, 7).value = "=G61-G62"
        wb.SHEETS(8).cells(63, 8).value = "=H61-H62"
        wb.SHEETS(8).cells(63, 9).value = "=I61-I62"
        wb.SHEETS(8).cells(63, 10).value = "=J61-J62"
        wb.SHEETS(8).cells(63, 11).value = "=K61-K62"
        wb.SHEETS(8).cells(63, 12).value = "=L61-L62"
        wb.SHEETS(8).cells(63, 13).value = "=M61-M62"
        wb.SHEETS(8).cells(63, 14).value = "=N61-N62"
        wb.SHEETS(8).cells(63, 15).value = "=O61-O62"

        wb.SHEETS(8).cells(9, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$L$10:$L$1000)"
        wb.SHEETS(8).cells(10, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$N$10:$N$1000)"
        wb.SHEETS(8).cells(11, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$O$10:$O$1000)"
        wb.SHEETS(8).cells(12, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$Q$10:$Q$1000)"
        wb.SHEETS(8).cells(13, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$R$10:$R$1000)"
        For I = Col + 1 To 14
            For J = 9 To 13
                wb.SHEETS(8).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(8).cells(18, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$V$10:$V$1000)"
        wb.SHEETS(8).cells(19, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$W$10:$W$1000)"
        wb.SHEETS(8).cells(20, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$X$10:$X$1000)"
        wb.SHEETS(8).cells(21, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$Z$10:$Z$1000)"
        wb.SHEETS(8).cells(22, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AB$10:$AB$1000)"
        wb.SHEETS(8).cells(23, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AD$10:$AD$1000)"
        wb.SHEETS(8).cells(24, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AF$10:$AF$1000)"
        For I = Col + 1 To 14
            For J = 18 To 24
                wb.SHEETS(8).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(8).cells(31, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AK$10:$AK$1000)"
        wb.SHEETS(8).cells(32, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AL$10:$AL$1000)"
        wb.SHEETS(8).cells(33, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AM$10:$AM$1000)"
        wb.SHEETS(8).cells(34, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AN$10:$AN$1000)"
        wb.SHEETS(8).cells(35, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AO$10:$AO$1000)"
        For I = Col + 1 To 14
            For J = 31 To 35
                wb.SHEETS(8).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(8).cells(42, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AT$10:$AT$1000)"
        For I = Col + 1 To 14
            For J = 42 To 42
                wb.SHEETS(8).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(8).cells(47, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AX$10:$AX$1000)"
        wb.SHEETS(8).cells(48, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AY$10:$AY$1000)"
        wb.SHEETS(8).cells(49, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AZ$10:$AZ$1000)"
        wb.SHEETS(8).cells(50, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BA$10:$BA$1000)"
        wb.SHEETS(8).cells(51, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BB$10:$BB$1000)"
        wb.SHEETS(8).cells(52, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BC$10:$BC$1000)"
        wb.SHEETS(8).cells(53, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BD$10:$BD$1000)"
        wb.SHEETS(8).cells(54, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BE$10:$BE$1000)"
        wb.SHEETS(8).cells(55, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BF$10:$BF$1000)"
        For I = Col + 1 To 14
            For J = 47 To 55
                wb.SHEETS(8).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(8).cells(60, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BK$10:$BK$1000)"
        For I = Col + 1 To 14
            For J = 60 To 60
                wb.SHEETS(8).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(8).cells(62, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BO$10:$BO$1000)"
        For I = Col + 1 To 14
            For J = 62 To 62
                wb.SHEETS(8).cells(J, I).value = 0
            Next
        Next

        wb.SHEETS(8).columns(2).columnwidth = 44
        For i = 3 To 15
            wb.SHEETS(8).columns(i).columnwidth = 12
            wb.SHEETS(8).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(8).RANGE("B1:O63").Copy()
        wb.SHEETS(8).RANGE("B65").select()
        wb.SHEETS(8).paste()
        wb.SHEETS(8).RANGE("B129").select()
        wb.SHEETS(8).paste()
        wb.SHEETS(8).RANGE("B193").select()
        wb.SHEETS(8).paste()
        wb.SHEETS(8).RANGE("B257").select()
        wb.SHEETS(8).paste()

        wb.SHEETS(8).cells(66, 2).value = "Autobuses Centrales de Guanajuato SA de CV"
        wb.SHEETS(8).cells(130, 2).value = "Servicio de Pasaje Terrestre del Bajio SA de CV"
        wb.SHEETS(8).cells(194, 2).value = "Union de Permisionarios de Autobuses Azules y Triangulos SA"
        wb.SHEETS(8).cells(258, 2).value = "Linea Centro Bellavista SA de CV"
        xl.application.cutcopymode = False


        wb.SHEETS(8).name = "EDO Resultados Empresa"
    End Sub
    Sub ResultadosRuta()
        Dim rng As Integer = 2

        wb.SHEETS(11).select()
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        wb.SHEETS(12).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(12).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(12).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(12).cells(1, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(12).cells(1, 2).FONT.SIZE = 14
        wb.SHEETS(12).cells(rng, 2).value = "Ruta 15 Auxiliar"
        wb.SHEETS(12).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(12).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(12).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(12).cells(rng, 2).value = "Estado de Resultados por Ruta"
        rng = rng + 2

        'AGREGA DEFINICIONES
        wb.SHEETS(12).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(12).cells(rng, 3).value = "ENERO"
        wb.SHEETS(12).cells(rng, 4).value = "FEBRERO"
        wb.SHEETS(12).cells(rng, 5).value = "MARZO"
        wb.SHEETS(12).cells(rng, 6).value = "ABRIL"
        wb.SHEETS(12).cells(rng, 7).value = "MAYO"
        wb.SHEETS(12).cells(rng, 8).value = "JUNIO"
        wb.SHEETS(12).cells(rng, 9).value = "JULIO"
        wb.SHEETS(12).cells(rng, 10).value = "AGOSTO"
        wb.SHEETS(12).cells(rng, 11).value = "SEPTIEMBRE"
        wb.SHEETS(12).cells(rng, 12).value = "OCTUBRE"
        wb.SHEETS(12).cells(rng, 13).value = "NOVIEMBRE"
        wb.SHEETS(12).cells(rng, 14).value = "DICIEMBRE"
        wb.SHEETS(12).cells(rng, 15).value = "ACUMULADO"

        For I = 2 To 15
            wb.SHEETS(12).cells(rng, I).font.bold = True
            wb.SHEETS(12).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(12).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(12).CELLS(rng, I).WrapText = True
            wb.SHEETS(12).CELLS(rng, I).Orientation = 0
            wb.SHEETS(12).CELLS(rng, I).AddIndent = False
            wb.SHEETS(12).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(12).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(12).CELLS(rng, I).MergeCells = False
            wb.SHEETS(12).CELLS(rng, I).ReadingOrder = -5002
        Next

        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(12).cells(9, 2).value = "Ingresos Boletos de Abordo"
        wb.SHEETS(12).cells(10, 2).value = "Ingresos Pagobus"
        wb.SHEETS(12).cells(11, 2).value = "Ingresos Red Integral Optibus"
        wb.SHEETS(12).cells(12, 2).value = "Otros Ingresos"
        wb.SHEETS(12).cells(13, 2).value = "Servicios Especiales"
        wb.SHEETS(12).cells(15, 2).value = "Total de Ingresos"


        wb.SHEETS(12).Range("C15:O15").INTERIOR.ThemeColor = 1
        wb.SHEETS(12).Range("C15:O15").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(12).Range("C26:O26").INTERIOR.ThemeColor = 1
        wb.SHEETS(12).Range("C26:O26").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(12).Range("C37:O37").INTERIOR.ThemeColor = 1
        wb.SHEETS(12).Range("C37:O37").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(12).Range("C57:O57").INTERIOR.ThemeColor = 1
        wb.SHEETS(12).Range("C57:O57").INTERIOR.TintAndShade = -0.0499893185216834

        wb.SHEETS(12).Range("C28:O28").INTERIOR.ThemeColor = 1
        wb.SHEETS(12).Range("C28:O28").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(12).Range("C39:O39").INTERIOR.ThemeColor = 1
        wb.SHEETS(12).Range("C39:O39").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(12).Range("C44:O44").INTERIOR.ThemeColor = 1
        wb.SHEETS(12).Range("C44:O44").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(12).Range("C59:O59").INTERIOR.ThemeColor = 1
        wb.SHEETS(12).Range("C59:O59").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(12).Range("C61:O61").INTERIOR.ThemeColor = 1
        wb.SHEETS(12).Range("C61:O61").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(12).Range("C63:O63").INTERIOR.ThemeColor = 1
        wb.SHEETS(12).Range("C63:O63").INTERIOR.TintAndShade = -0.149998474074526

        wb.SHEETS(12).cells(17, 2).value = "COSTOS DIRECTOS"
        wb.SHEETS(12).cells(18, 2).value = "Diesel"
        wb.SHEETS(12).cells(19, 2).value = "Sueldos y Salarios"
        wb.SHEETS(12).cells(20, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(12).cells(21, 2).value = "Refacciones"
        wb.SHEETS(12).cells(22, 2).value = "Mantenimiento y Reparación de Autobuses"
        wb.SHEETS(12).cells(23, 2).value = "Llantas Nuevas"
        wb.SHEETS(12).cells(24, 2).value = "Llantas Vitalizadas"
        wb.SHEETS(12).cells(26, 2).value = "Total de Costos Directos"

        wb.SHEETS(12).cells(28, 2).value = "UTILIDAD BRUTA"

        wb.SHEETS(12).cells(30, 2).value = "COSTOS INDIRECTOS DE OPERACIÓN"
        wb.SHEETS(12).cells(31, 2).value = "Gastos de Mantenimiento"
        wb.SHEETS(12).cells(32, 2).value = "Gastos de Operación y Servicios"
        wb.SHEETS(12).cells(33, 2).value = "Gastos de Seguro Interno"
        wb.SHEETS(12).cells(34, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(12).cells(35, 2).value = "Gastos Diversos de Operación"
        wb.SHEETS(12).cells(37, 2).value = "Total de Costos Indirectos"

        wb.SHEETS(12).cells(39, 2).value = "UTILIDAD MARGINAL"

        wb.SHEETS(12).cells(41, 2).value = "COSTOS INDIRECTOS DE ADMINISTRACIÓN"
        wb.SHEETS(12).cells(42, 2).value = "Gastos de Administración"

        wb.SHEETS(12).cells(44, 2).value = "UTILIDAD ANTES DE RESERVAS"

        wb.SHEETS(12).cells(46, 2).value = "RESERVAS"
        wb.SHEETS(12).cells(47, 2).value = "Reserva para Aguinaldo"
        wb.SHEETS(12).cells(48, 2).value = "Reserva para Tenencias y Refrendos"
        wb.SHEETS(12).cells(49, 2).value = "Reserva para Prima de Seguros"
        wb.SHEETS(12).cells(50, 2).value = "Fondo para Renovación de Equipo"
        wb.SHEETS(12).cells(51, 2).value = "Aportaciones al Fideicomiso"
        wb.SHEETS(12).cells(52, 2).value = "Reserva para Capacitación Adiestramiento Seguridad e Higiene y Otros"
        wb.SHEETS(12).cells(53, 2).value = "Reserva  PTU"
        wb.SHEETS(12).cells(54, 2).value = "Reserva para Uniformes y Otros Gastos Mayores"
        wb.SHEETS(12).cells(55, 2).value = "Reserva para Adquisición de Activos"

        wb.SHEETS(12).cells(57, 2).value = "Total de Reservas"

        wb.SHEETS(12).cells(59, 2).value = "RESULTADO ANTES DE DOCUMENTOS"
        wb.SHEETS(12).cells(60, 2).value = "Documento de Unidades"
        wb.SHEETS(12).cells(61, 2).value = "RESULTADO ANTES IMPUESTOS"
        wb.SHEETS(12).cells(62, 2).value = "Impuesto Sobre la Renta"
        wb.SHEETS(12).cells(63, 2).value = "RESULTADO NETO"

        For i = 9 To 63
            wb.SHEETS(12).cells(i, 15).value = "=SUMA(C" & i & ":N" & i & ")"
        Next
        wb.SHEETS(12).cells(16, 15).value = ""
        wb.SHEETS(12).cells(27, 15).value = ""
        wb.SHEETS(12).cells(29, 15).value = ""
        wb.SHEETS(12).cells(38, 15).value = ""
        wb.SHEETS(12).cells(40, 15).value = ""
        wb.SHEETS(12).cells(43, 15).value = ""
        wb.SHEETS(12).cells(45, 15).value = ""
        wb.SHEETS(12).cells(56, 15).value = ""
        wb.SHEETS(12).cells(58, 15).value = ""
        wb.SHEETS(12).cells(17, 15).value = ""
        wb.SHEETS(12).cells(30, 15).value = ""
        wb.SHEETS(12).cells(41, 15).value = ""
        wb.SHEETS(12).cells(46, 15).value = ""
        wb.SHEETS(12).cells(14, 15).value = ""
        wb.SHEETS(12).cells(25, 15).value = ""
        wb.SHEETS(12).cells(36, 15).value = ""

        wb.SHEETS(12).cells(15, 3).value = "=SUMA(C9:C14)"
        wb.SHEETS(12).cells(15, 4).value = "=SUMA(D9:D14)"
        wb.SHEETS(12).cells(15, 5).value = "=SUMA(E9:E14)"
        wb.SHEETS(12).cells(15, 6).value = "=SUMA(F9:F14)"
        wb.SHEETS(12).cells(15, 7).value = "=SUMA(G9:G14)"
        wb.SHEETS(12).cells(15, 8).value = "=SUMA(H9:H14)"
        wb.SHEETS(12).cells(15, 9).value = "=SUMA(I9:I14)"
        wb.SHEETS(12).cells(15, 10).value = "=SUMA(J9:J14)"
        wb.SHEETS(12).cells(15, 11).value = "=SUMA(K9:K14)"
        wb.SHEETS(12).cells(15, 12).value = "=SUMA(L9:L14)"
        wb.SHEETS(12).cells(15, 13).value = "=SUMA(M9:M14)"
        wb.SHEETS(12).cells(15, 14).value = "=SUMA(N9:N14)"
        wb.SHEETS(12).cells(15, 15).value = "=SUMA(O9:O14)"



        wb.SHEETS(12).cells(26, 3).value = "=SUMA(C18:C25)"
        wb.SHEETS(12).cells(26, 4).value = "=SUMA(D18:D25)"
        wb.SHEETS(12).cells(26, 5).value = "=SUMA(E18:E25)"
        wb.SHEETS(12).cells(26, 6).value = "=SUMA(F18:F25)"
        wb.SHEETS(12).cells(26, 7).value = "=SUMA(G18:G25)"
        wb.SHEETS(12).cells(26, 8).value = "=SUMA(H18:H25)"
        wb.SHEETS(12).cells(26, 9).value = "=SUMA(I18:I25)"
        wb.SHEETS(12).cells(26, 10).value = "=SUMA(J18:J25)"
        wb.SHEETS(12).cells(26, 11).value = "=SUMA(K18:K25)"
        wb.SHEETS(12).cells(26, 12).value = "=SUMA(L18:L25)"
        wb.SHEETS(12).cells(26, 13).value = "=SUMA(M18:M25)"
        wb.SHEETS(12).cells(26, 14).value = "=SUMA(N18:N25)"
        wb.SHEETS(12).cells(26, 15).value = "=SUMA(O18:O25)"

        wb.SHEETS(12).cells(28, 3).value = "=C15-C26"
        wb.SHEETS(12).cells(28, 4).value = "=D15-D26"
        wb.SHEETS(12).cells(28, 5).value = "=E15-E26"
        wb.SHEETS(12).cells(28, 6).value = "=F15-F26"
        wb.SHEETS(12).cells(28, 7).value = "=G15-G26"
        wb.SHEETS(12).cells(28, 8).value = "=H15-H26"
        wb.SHEETS(12).cells(28, 9).value = "=I15-I26"
        wb.SHEETS(12).cells(28, 10).value = "=J15-J26"
        wb.SHEETS(12).cells(28, 11).value = "=K15-K26"
        wb.SHEETS(12).cells(28, 12).value = "=L15-L26"
        wb.SHEETS(12).cells(28, 13).value = "=M15-M26"
        wb.SHEETS(12).cells(28, 14).value = "=N15-N26"
        wb.SHEETS(12).cells(28, 15).value = "=O15-O26"

        wb.SHEETS(12).cells(37, 3).value = "=SUMA(C31:C36)"
        wb.SHEETS(12).cells(37, 4).value = "=SUMA(D31:D36)"
        wb.SHEETS(12).cells(37, 5).value = "=SUMA(E31:E36)"
        wb.SHEETS(12).cells(37, 6).value = "=SUMA(F31:F36)"
        wb.SHEETS(12).cells(37, 7).value = "=SUMA(G31:G36)"
        wb.SHEETS(12).cells(37, 8).value = "=SUMA(H31:H36)"
        wb.SHEETS(12).cells(37, 9).value = "=SUMA(I31:I36)"
        wb.SHEETS(12).cells(37, 10).value = "=SUMA(J31:J36)"
        wb.SHEETS(12).cells(37, 11).value = "=SUMA(K31:K36)"
        wb.SHEETS(12).cells(37, 12).value = "=SUMA(L18:L36)"
        wb.SHEETS(12).cells(37, 13).value = "=SUMA(M31:M36)"
        wb.SHEETS(12).cells(37, 14).value = "=SUMA(N31:N36)"
        wb.SHEETS(12).cells(37, 15).value = "=SUMA(O31:O36)"

        wb.SHEETS(12).cells(39, 3).value = "=C28-C37"
        wb.SHEETS(12).cells(39, 4).value = "=D28-D37"
        wb.SHEETS(12).cells(39, 5).value = "=E28-E37"
        wb.SHEETS(12).cells(39, 6).value = "=F28-F37"
        wb.SHEETS(12).cells(39, 7).value = "=G28-G37"
        wb.SHEETS(12).cells(39, 8).value = "=H28-H37"
        wb.SHEETS(12).cells(39, 9).value = "=I28-I37"
        wb.SHEETS(12).cells(39, 10).value = "=J28-J37"
        wb.SHEETS(12).cells(39, 11).value = "=K28-K37"
        wb.SHEETS(12).cells(39, 12).value = "=L28-L37"
        wb.SHEETS(12).cells(39, 13).value = "=M28-M37"
        wb.SHEETS(12).cells(39, 14).value = "=N28-N37"
        wb.SHEETS(12).cells(39, 15).value = "=O28-O37"

        wb.SHEETS(12).cells(44, 3).value = "=C39-C42"
        wb.SHEETS(12).cells(44, 4).value = "=D39-D42"
        wb.SHEETS(12).cells(44, 5).value = "=E39-E42"
        wb.SHEETS(12).cells(44, 6).value = "=F39-F42"
        wb.SHEETS(12).cells(44, 7).value = "=G39-G42"
        wb.SHEETS(12).cells(44, 8).value = "=H39-H42"
        wb.SHEETS(12).cells(44, 9).value = "=I39-I42"
        wb.SHEETS(12).cells(44, 10).value = "=J39-J42"
        wb.SHEETS(12).cells(44, 11).value = "=K39-K42"
        wb.SHEETS(12).cells(44, 12).value = "=L39-L42"
        wb.SHEETS(12).cells(44, 13).value = "=M39-M42"
        wb.SHEETS(12).cells(44, 14).value = "=N39-N42"
        wb.SHEETS(12).cells(44, 15).value = "=O39-O42"

        wb.SHEETS(12).cells(57, 3).value = "=SUMA(C47:C56)"
        wb.SHEETS(12).cells(57, 4).value = "=SUMA(D47:D56)"
        wb.SHEETS(12).cells(57, 5).value = "=SUMA(E47:E56)"
        wb.SHEETS(12).cells(57, 6).value = "=SUMA(F47:F56)"
        wb.SHEETS(12).cells(57, 7).value = "=SUMA(G47:G56)"
        wb.SHEETS(12).cells(57, 8).value = "=SUMA(H47:H56)"
        wb.SHEETS(12).cells(57, 9).value = "=SUMA(I47:I56)"
        wb.SHEETS(12).cells(57, 10).value = "=SUMA(J47:J56)"
        wb.SHEETS(12).cells(57, 11).value = "=SUMA(K47:K56)"
        wb.SHEETS(12).cells(57, 12).value = "=SUMA(L47:L56)"
        wb.SHEETS(12).cells(57, 13).value = "=SUMA(M47:M56)"
        wb.SHEETS(12).cells(57, 14).value = "=SUMA(N47:N56)"
        wb.SHEETS(12).cells(57, 15).value = "=SUMA(O47:O56)"

        wb.SHEETS(12).cells(59, 3).value = "=C44-C57"
        wb.SHEETS(12).cells(59, 4).value = "=D44-D57"
        wb.SHEETS(12).cells(59, 5).value = "=E44-E57"
        wb.SHEETS(12).cells(59, 6).value = "=F44-F57"
        wb.SHEETS(12).cells(59, 7).value = "=G44-G57"
        wb.SHEETS(12).cells(59, 8).value = "=H44-H57"
        wb.SHEETS(12).cells(59, 9).value = "=I44-I57"
        wb.SHEETS(12).cells(59, 10).value = "=J44-J57"
        wb.SHEETS(12).cells(59, 11).value = "=K44-K57"
        wb.SHEETS(12).cells(59, 12).value = "=L44-L57"
        wb.SHEETS(12).cells(59, 13).value = "=M44-M57"
        wb.SHEETS(12).cells(59, 14).value = "=N44-N57"
        wb.SHEETS(12).cells(59, 15).value = "=O44-O57"

        wb.SHEETS(12).cells(61, 3).value = "=C59-C60"
        wb.SHEETS(12).cells(61, 4).value = "=D59-D60"
        wb.SHEETS(12).cells(61, 5).value = "=E59-E60"
        wb.SHEETS(12).cells(61, 6).value = "=F59-F60"
        wb.SHEETS(12).cells(61, 7).value = "=G59-G60"
        wb.SHEETS(12).cells(61, 8).value = "=H59-H60"
        wb.SHEETS(12).cells(61, 9).value = "=I59-I60"
        wb.SHEETS(12).cells(61, 10).value = "=J59-J60"
        wb.SHEETS(12).cells(61, 11).value = "=K59-K60"
        wb.SHEETS(12).cells(61, 12).value = "=L59-L60"
        wb.SHEETS(12).cells(61, 13).value = "=M59-M60"
        wb.SHEETS(12).cells(61, 14).value = "=N59-N60"
        wb.SHEETS(12).cells(61, 15).value = "=O59-O60"

        wb.SHEETS(12).cells(63, 3).value = "=C61-C62"
        wb.SHEETS(12).cells(63, 4).value = "=D61-D62"
        wb.SHEETS(12).cells(63, 5).value = "=E61-E62"
        wb.SHEETS(12).cells(63, 6).value = "=F61-F62"
        wb.SHEETS(12).cells(63, 7).value = "=G61-G62"
        wb.SHEETS(12).cells(63, 8).value = "=H61-H62"
        wb.SHEETS(12).cells(63, 9).value = "=I61-I62"
        wb.SHEETS(12).cells(63, 10).value = "=J61-J62"
        wb.SHEETS(12).cells(63, 11).value = "=K61-K62"
        wb.SHEETS(12).cells(63, 12).value = "=L61-L62"
        wb.SHEETS(12).cells(63, 13).value = "=M61-M62"
        wb.SHEETS(12).cells(63, 14).value = "=N61-N62"
        wb.SHEETS(12).cells(63, 15).value = "=O61-O62"

        wb.SHEETS(12).cells(9, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$L$10:$L$1000)"
        wb.SHEETS(12).cells(10, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$N$10:$N$1000)"
        wb.SHEETS(12).cells(11, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$O$10:$O$1000)"
        wb.SHEETS(12).cells(12, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$Q$10:$Q$1000)"
        wb.SHEETS(12).cells(13, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$R$10:$R$1000)"
        For I = Col + 1 To 14
            For J = 9 To 13
                wb.SHEETS(12).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(12).cells(18, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$V$10:$V$1000)"
        wb.SHEETS(12).cells(19, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$W$10:$W$1000)"
        wb.SHEETS(12).cells(20, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$X$10:$X$1000)"
        wb.SHEETS(12).cells(21, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$Z$10:$Z$1000)"
        wb.SHEETS(12).cells(22, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AB$10:$AB$1000)"
        wb.SHEETS(12).cells(23, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AD$10:$AD$1000)"
        wb.SHEETS(12).cells(24, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AF$10:$AF$1000)"
        For I = Col + 1 To 14
            For J = 18 To 24
                wb.SHEETS(12).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(12).cells(31, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AK$10:$AK$1000)"
        wb.SHEETS(12).cells(32, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AL$10:$AL$1000)"
        wb.SHEETS(12).cells(33, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AM$10:$AM$1000)"
        wb.SHEETS(12).cells(34, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AN$10:$AN$1000)"
        wb.SHEETS(12).cells(35, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AO$10:$AO$1000)"
        For I = Col + 1 To 14
            For J = 31 To 35
                wb.SHEETS(12).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(12).cells(42, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AT$10:$AT$1000)"
        For I = Col + 1 To 14
            For J = 42 To 42
                wb.SHEETS(12).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(12).cells(47, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AX$10:$AX$1000)"
        wb.SHEETS(12).cells(48, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AY$10:$AY$1000)"
        wb.SHEETS(12).cells(49, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$AZ$10:$AZ$1000)"
        wb.SHEETS(12).cells(50, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$BA$10:$BA$1000)"
        wb.SHEETS(12).cells(51, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$BB$10:$BB$1000)"
        wb.SHEETS(12).cells(52, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$BC$10:$BC$1000)"
        wb.SHEETS(12).cells(53, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$BD$10:$BD$1000)"
        wb.SHEETS(12).cells(54, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$BE$10:$BE$1000)"
        wb.SHEETS(12).cells(55, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$BF$10:$BF$1000)"
        For I = Col + 1 To 14
            For J = 47 To 55
                wb.SHEETS(12).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(12).cells(60, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$BK$10:$BK$1000)"
        For I = Col + 1 To 14
            For J = 60 To 60
                wb.SHEETS(12).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(12).cells(62, Col).value = "=SUMAR.SI(RPA!$E$10:$BO$1000,B2,RPA!$BO$10:$BO$1000)"
        For I = Col + 1 To 14
            For J = 62 To 62
                wb.SHEETS(12).cells(J, I).value = 0
            Next
        Next

        wb.SHEETS(12).columns(2).columnwidth = 44
        For i = 3 To 15
            wb.SHEETS(12).columns(i).columnwidth = 12
            wb.SHEETS(12).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(12).RANGE("B1:O63").Copy()
        wb.SHEETS(12).RANGE("B65").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B129").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B193").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B257").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B321").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B385").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B449").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B513").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B577").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B641").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B705").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B769").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B833").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B897").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B961").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B1025").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B1089").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B1153").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B1217").select()
        wb.SHEETS(12).paste()
        wb.SHEETS(12).RANGE("B1281").select()
        wb.SHEETS(12).paste()

        wb.SHEETS(12).cells(66, 2).value = "Ruta 16 Alimentadora"
        wb.SHEETS(12).cells(130, 2).value = "Ruta 35 Alimentadora"
        wb.SHEETS(12).cells(194, 2).value = "Ruta 66 Alimentadora"
        wb.SHEETS(12).cells(258, 2).value = "Ruta 73 Auxiliar"
        wb.SHEETS(12).cells(322, 2).value = "Ruta 9 Auxiliar"
        wb.SHEETS(12).cells(386, 2).value = "Ruta 77"
        wb.SHEETS(12).cells(450, 2).value = "Ruta 78"
        wb.SHEETS(12).cells(514, 2).value = "Sub-Urbanos"
        wb.SHEETS(12).cells(578, 2).value = "Centrales de Guanajuato"
        wb.SHEETS(12).cells(642, 2).value = "Pasaje Terrestre"
        wb.SHEETS(12).cells(706, 2).value = "Azules y Triangulo"
        wb.SHEETS(12).cells(770, 2).value = "Ruta 1"
        wb.SHEETS(12).cells(834, 2).value = "Ruta 1 Autxiliar"
        wb.SHEETS(12).cells(898, 2).value = "Ruta 11 Auxiliar"
        wb.SHEETS(12).cells(962, 2).value = "Ruta 16"
        wb.SHEETS(12).cells(1026, 2).value = "Ruta 17"
        wb.SHEETS(12).cells(1090, 2).value = "Ruta 3"
        wb.SHEETS(12).cells(1154, 2).value = "Ruta 53 Alimentadora"
        wb.SHEETS(12).cells(1218, 2).value = "Ruta 55"
        wb.SHEETS(12).cells(1282, 2).value = "Ruta 86"
        xl.application.cutcopymode = False

        wb.SHEETS(12).name = "EDO Resultados Ruta"

    End Sub
    Sub ResultadosUrbano()
        Dim rng As Integer = 2

        wb.SHEETS(10).select()
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        wb.SHEETS(11).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(11).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(11).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(11).cells(rng, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(11).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(11).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(11).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(11).cells(rng, 2).value = "Estado de Resultados Sector Urbano"
        rng = rng + 2

        'AGREGA DEFINICIONES
        wb.SHEETS(11).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(11).cells(rng, 3).value = "ENERO"
        wb.SHEETS(11).cells(rng, 4).value = "FEBRERO"
        wb.SHEETS(11).cells(rng, 5).value = "MARZO"
        wb.SHEETS(11).cells(rng, 6).value = "ABRIL"
        wb.SHEETS(11).cells(rng, 7).value = "MAYO"
        wb.SHEETS(11).cells(rng, 8).value = "JUNIO"
        wb.SHEETS(11).cells(rng, 9).value = "JULIO"
        wb.SHEETS(11).cells(rng, 10).value = "AGOSTO"
        wb.SHEETS(11).cells(rng, 11).value = "SEPTIEMBRE"
        wb.SHEETS(11).cells(rng, 12).value = "OCTUBRE"
        wb.SHEETS(11).cells(rng, 13).value = "NOVIEMBRE"
        wb.SHEETS(11).cells(rng, 14).value = "DICIEMBRE"
        wb.SHEETS(11).cells(rng, 15).value = "ACUMULADO"

        For I = 2 To 15
            wb.SHEETS(11).cells(rng, I).font.bold = True
            wb.SHEETS(11).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(11).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(11).CELLS(rng, I).WrapText = True
            wb.SHEETS(11).CELLS(rng, I).Orientation = 0
            wb.SHEETS(11).CELLS(rng, I).AddIndent = False
            wb.SHEETS(11).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(11).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(11).CELLS(rng, I).MergeCells = False
            wb.SHEETS(11).CELLS(rng, I).ReadingOrder = -5002
        Next

        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(11).cells(9, 2).value = "Ingresos Boletos de Abordo"
        wb.SHEETS(11).cells(10, 2).value = "Ingresos Pagobus"
        wb.SHEETS(11).cells(11, 2).value = "Ingresos Red Integral Optibus"
        wb.SHEETS(11).cells(12, 2).value = "Otros Ingresos"
        wb.SHEETS(11).cells(13, 2).value = "Servicios Especiales"
        wb.SHEETS(11).cells(15, 2).value = "Total de Ingresos"


        wb.SHEETS(11).Range("C15:O15").INTERIOR.ThemeColor = 1
        wb.SHEETS(11).Range("C15:O15").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(11).Range("C26:O26").INTERIOR.ThemeColor = 1
        wb.SHEETS(11).Range("C26:O26").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(11).Range("C37:O37").INTERIOR.ThemeColor = 1
        wb.SHEETS(11).Range("C37:O37").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(11).Range("C57:O57").INTERIOR.ThemeColor = 1
        wb.SHEETS(11).Range("C57:O57").INTERIOR.TintAndShade = -0.0499893185216834

        wb.SHEETS(11).Range("C28:O28").INTERIOR.ThemeColor = 1
        wb.SHEETS(11).Range("C28:O28").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(11).Range("C39:O39").INTERIOR.ThemeColor = 1
        wb.SHEETS(11).Range("C39:O39").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(11).Range("C44:O44").INTERIOR.ThemeColor = 1
        wb.SHEETS(11).Range("C44:O44").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(11).Range("C59:O59").INTERIOR.ThemeColor = 1
        wb.SHEETS(11).Range("C59:O59").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(11).Range("C61:O61").INTERIOR.ThemeColor = 1
        wb.SHEETS(11).Range("C61:O61").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(11).Range("C63:O63").INTERIOR.ThemeColor = 1
        wb.SHEETS(11).Range("C63:O63").INTERIOR.TintAndShade = -0.149998474074526

        wb.SHEETS(11).cells(17, 2).value = "COSTOS DIRECTOS"
        wb.SHEETS(11).cells(18, 2).value = "Diesel"
        wb.SHEETS(11).cells(19, 2).value = "Sueldos y Salarios"
        wb.SHEETS(11).cells(20, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(11).cells(21, 2).value = "Refacciones"
        wb.SHEETS(11).cells(22, 2).value = "Mantenimiento y Reparación de Autobuses"
        wb.SHEETS(11).cells(23, 2).value = "Llantas Nuevas"
        wb.SHEETS(11).cells(24, 2).value = "Llantas Vitalizadas"
        wb.SHEETS(11).cells(26, 2).value = "Total de Costos Directos"

        wb.SHEETS(11).cells(28, 2).value = "UTILIDAD BRUTA"

        wb.SHEETS(11).cells(30, 2).value = "COSTOS INDIRECTOS DE OPERACIÓN"
        wb.SHEETS(11).cells(31, 2).value = "Gastos de Mantenimiento"
        wb.SHEETS(11).cells(32, 2).value = "Gastos de Operación y Servicios"
        wb.SHEETS(11).cells(33, 2).value = "Gastos de Seguro Interno"
        wb.SHEETS(11).cells(34, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(11).cells(35, 2).value = "Gastos Diversos de Operación"
        wb.SHEETS(11).cells(37, 2).value = "Total de Costos Indirectos"

        wb.SHEETS(11).cells(39, 2).value = "UTILIDAD MARGINAL"

        wb.SHEETS(11).cells(41, 2).value = "COSTOS INDIRECTOS DE ADMINISTRACIÓN"
        wb.SHEETS(11).cells(42, 2).value = "Gastos de Administración"

        wb.SHEETS(11).cells(44, 2).value = "UTILIDAD ANTES DE RESERVAS"

        wb.SHEETS(11).cells(46, 2).value = "RESERVAS"
        wb.SHEETS(11).cells(47, 2).value = "Reserva para Aguinaldo"
        wb.SHEETS(11).cells(48, 2).value = "Reserva para Tenencias y Refrendos"
        wb.SHEETS(11).cells(49, 2).value = "Reserva para Prima de Seguros"
        wb.SHEETS(11).cells(50, 2).value = "Fondo para Renovación de Equipo"
        wb.SHEETS(11).cells(51, 2).value = "Aportaciones al Fideicomiso"
        wb.SHEETS(11).cells(52, 2).value = "Reserva para Capacitación Adiestramiento Seguridad e Higiene y Otros"
        wb.SHEETS(11).cells(53, 2).value = "Reserva  PTU"
        wb.SHEETS(11).cells(54, 2).value = "Reserva para Uniformes y Otros Gastos Mayores"
        wb.SHEETS(11).cells(55, 2).value = "Reserva para Adquisición de Activos"

        wb.SHEETS(11).cells(57, 2).value = "Total de Reservas"

        wb.SHEETS(11).cells(59, 2).value = "RESULTADO ANTES DE DOCUMENTOS"
        wb.SHEETS(11).cells(60, 2).value = "Documento de Unidades"
        wb.SHEETS(11).cells(61, 2).value = "RESULTADO ANTES IMPUESTOS"
        wb.SHEETS(11).cells(62, 2).value = "Impuesto Sobre la Renta"
        wb.SHEETS(11).cells(63, 2).value = "RESULTADO NETO"

        For i = 9 To 63
            wb.SHEETS(11).cells(i, 15).value = "=SUMA(C" & i & ":N" & i & ")"
        Next
        wb.SHEETS(11).cells(16, 15).value = ""
        wb.SHEETS(11).cells(27, 15).value = ""
        wb.SHEETS(11).cells(29, 15).value = ""
        wb.SHEETS(11).cells(38, 15).value = ""
        wb.SHEETS(11).cells(40, 15).value = ""
        wb.SHEETS(11).cells(43, 15).value = ""
        wb.SHEETS(11).cells(45, 15).value = ""
        wb.SHEETS(11).cells(56, 15).value = ""
        wb.SHEETS(11).cells(58, 15).value = ""
        wb.SHEETS(11).cells(17, 15).value = ""
        wb.SHEETS(11).cells(30, 15).value = ""
        wb.SHEETS(11).cells(41, 15).value = ""
        wb.SHEETS(11).cells(46, 15).value = ""
        wb.SHEETS(11).cells(14, 15).value = ""
        wb.SHEETS(11).cells(25, 15).value = ""
        wb.SHEETS(11).cells(36, 15).value = ""

        wb.SHEETS(11).cells(15, 3).value = "=SUMA(C9:C14)"
        wb.SHEETS(11).cells(15, 4).value = "=SUMA(D9:D14)"
        wb.SHEETS(11).cells(15, 5).value = "=SUMA(E9:E14)"
        wb.SHEETS(11).cells(15, 6).value = "=SUMA(F9:F14)"
        wb.SHEETS(11).cells(15, 7).value = "=SUMA(G9:G14)"
        wb.SHEETS(11).cells(15, 8).value = "=SUMA(H9:H14)"
        wb.SHEETS(11).cells(15, 9).value = "=SUMA(I9:I14)"
        wb.SHEETS(11).cells(15, 10).value = "=SUMA(J9:J14)"
        wb.SHEETS(11).cells(15, 11).value = "=SUMA(K9:K14)"
        wb.SHEETS(11).cells(15, 12).value = "=SUMA(L9:L14)"
        wb.SHEETS(11).cells(15, 13).value = "=SUMA(M9:M14)"
        wb.SHEETS(11).cells(15, 14).value = "=SUMA(N9:N14)"
        wb.SHEETS(11).cells(15, 15).value = "=SUMA(O9:O14)"



        wb.SHEETS(11).cells(26, 3).value = "=SUMA(C18:C25)"
        wb.SHEETS(11).cells(26, 4).value = "=SUMA(D18:D25)"
        wb.SHEETS(11).cells(26, 5).value = "=SUMA(E18:E25)"
        wb.SHEETS(11).cells(26, 6).value = "=SUMA(F18:F25)"
        wb.SHEETS(11).cells(26, 7).value = "=SUMA(G18:G25)"
        wb.SHEETS(11).cells(26, 8).value = "=SUMA(H18:H25)"
        wb.SHEETS(11).cells(26, 9).value = "=SUMA(I18:I25)"
        wb.SHEETS(11).cells(26, 10).value = "=SUMA(J18:J25)"
        wb.SHEETS(11).cells(26, 11).value = "=SUMA(K18:K25)"
        wb.SHEETS(11).cells(26, 12).value = "=SUMA(L18:L25)"
        wb.SHEETS(11).cells(26, 13).value = "=SUMA(M18:M25)"
        wb.SHEETS(11).cells(26, 14).value = "=SUMA(N18:N25)"
        wb.SHEETS(11).cells(26, 15).value = "=SUMA(O18:O25)"

        wb.SHEETS(11).cells(28, 3).value = "=C15-C26"
        wb.SHEETS(11).cells(28, 4).value = "=D15-D26"
        wb.SHEETS(11).cells(28, 5).value = "=E15-E26"
        wb.SHEETS(11).cells(28, 6).value = "=F15-F26"
        wb.SHEETS(11).cells(28, 7).value = "=G15-G26"
        wb.SHEETS(11).cells(28, 8).value = "=H15-H26"
        wb.SHEETS(11).cells(28, 9).value = "=I15-I26"
        wb.SHEETS(11).cells(28, 10).value = "=J15-J26"
        wb.SHEETS(11).cells(28, 11).value = "=K15-K26"
        wb.SHEETS(11).cells(28, 12).value = "=L15-L26"
        wb.SHEETS(11).cells(28, 13).value = "=M15-M26"
        wb.SHEETS(11).cells(28, 14).value = "=N15-N26"
        wb.SHEETS(11).cells(28, 15).value = "=O15-O26"

        wb.SHEETS(11).cells(37, 3).value = "=SUMA(C31:C36)"
        wb.SHEETS(11).cells(37, 4).value = "=SUMA(D31:D36)"
        wb.SHEETS(11).cells(37, 5).value = "=SUMA(E31:E36)"
        wb.SHEETS(11).cells(37, 6).value = "=SUMA(F31:F36)"
        wb.SHEETS(11).cells(37, 7).value = "=SUMA(G31:G36)"
        wb.SHEETS(11).cells(37, 8).value = "=SUMA(H31:H36)"
        wb.SHEETS(11).cells(37, 9).value = "=SUMA(I31:I36)"
        wb.SHEETS(11).cells(37, 10).value = "=SUMA(J31:J36)"
        wb.SHEETS(11).cells(37, 11).value = "=SUMA(K31:K36)"
        wb.SHEETS(11).cells(37, 12).value = "=SUMA(L18:L36)"
        wb.SHEETS(11).cells(37, 13).value = "=SUMA(M31:M36)"
        wb.SHEETS(11).cells(37, 14).value = "=SUMA(N31:N36)"
        wb.SHEETS(11).cells(37, 15).value = "=SUMA(O31:O36)"

        wb.SHEETS(11).cells(39, 3).value = "=C28-C37"
        wb.SHEETS(11).cells(39, 4).value = "=D28-D37"
        wb.SHEETS(11).cells(39, 5).value = "=E28-E37"
        wb.SHEETS(11).cells(39, 6).value = "=F28-F37"
        wb.SHEETS(11).cells(39, 7).value = "=G28-G37"
        wb.SHEETS(11).cells(39, 8).value = "=H28-H37"
        wb.SHEETS(11).cells(39, 9).value = "=I28-I37"
        wb.SHEETS(11).cells(39, 10).value = "=J28-J37"
        wb.SHEETS(11).cells(39, 11).value = "=K28-K37"
        wb.SHEETS(11).cells(39, 12).value = "=L28-L37"
        wb.SHEETS(11).cells(39, 13).value = "=M28-M37"
        wb.SHEETS(11).cells(39, 14).value = "=N28-N37"
        wb.SHEETS(11).cells(39, 15).value = "=O28-O37"

        wb.SHEETS(11).cells(44, 3).value = "=C39-C42"
        wb.SHEETS(11).cells(44, 4).value = "=D39-D42"
        wb.SHEETS(11).cells(44, 5).value = "=E39-E42"
        wb.SHEETS(11).cells(44, 6).value = "=F39-F42"
        wb.SHEETS(11).cells(44, 7).value = "=G39-G42"
        wb.SHEETS(11).cells(44, 8).value = "=H39-H42"
        wb.SHEETS(11).cells(44, 9).value = "=I39-I42"
        wb.SHEETS(11).cells(44, 10).value = "=J39-J42"
        wb.SHEETS(11).cells(44, 11).value = "=K39-K42"
        wb.SHEETS(11).cells(44, 12).value = "=L39-L42"
        wb.SHEETS(11).cells(44, 13).value = "=M39-M42"
        wb.SHEETS(11).cells(44, 14).value = "=N39-N42"
        wb.SHEETS(11).cells(44, 15).value = "=O39-O42"

        wb.SHEETS(11).cells(57, 3).value = "=SUMA(C47:C56)"
        wb.SHEETS(11).cells(57, 4).value = "=SUMA(D47:D56)"
        wb.SHEETS(11).cells(57, 5).value = "=SUMA(E47:E56)"
        wb.SHEETS(11).cells(57, 6).value = "=SUMA(F47:F56)"
        wb.SHEETS(11).cells(57, 7).value = "=SUMA(G47:G56)"
        wb.SHEETS(11).cells(57, 8).value = "=SUMA(H47:H56)"
        wb.SHEETS(11).cells(57, 9).value = "=SUMA(I47:I56)"
        wb.SHEETS(11).cells(57, 10).value = "=SUMA(J47:J56)"
        wb.SHEETS(11).cells(57, 11).value = "=SUMA(K47:K56)"
        wb.SHEETS(11).cells(57, 12).value = "=SUMA(L47:L56)"
        wb.SHEETS(11).cells(57, 13).value = "=SUMA(M47:M56)"
        wb.SHEETS(11).cells(57, 14).value = "=SUMA(N47:N56)"
        wb.SHEETS(11).cells(57, 15).value = "=SUMA(O47:O56)"

        wb.SHEETS(11).cells(59, 3).value = "=C44-C57"
        wb.SHEETS(11).cells(59, 4).value = "=D44-D57"
        wb.SHEETS(11).cells(59, 5).value = "=E44-E57"
        wb.SHEETS(11).cells(59, 6).value = "=F44-F57"
        wb.SHEETS(11).cells(59, 7).value = "=G44-G57"
        wb.SHEETS(11).cells(59, 8).value = "=H44-H57"
        wb.SHEETS(11).cells(59, 9).value = "=I44-I57"
        wb.SHEETS(11).cells(59, 10).value = "=J44-J57"
        wb.SHEETS(11).cells(59, 11).value = "=K44-K57"
        wb.SHEETS(11).cells(59, 12).value = "=L44-L57"
        wb.SHEETS(11).cells(59, 13).value = "=M44-M57"
        wb.SHEETS(11).cells(59, 14).value = "=N44-N57"
        wb.SHEETS(11).cells(59, 15).value = "=O44-O57"

        wb.SHEETS(11).cells(61, 3).value = "=C59-C60"
        wb.SHEETS(11).cells(61, 4).value = "=D59-D60"
        wb.SHEETS(11).cells(61, 5).value = "=E59-E60"
        wb.SHEETS(11).cells(61, 6).value = "=F59-F60"
        wb.SHEETS(11).cells(61, 7).value = "=G59-G60"
        wb.SHEETS(11).cells(61, 8).value = "=H59-H60"
        wb.SHEETS(11).cells(61, 9).value = "=I59-I60"
        wb.SHEETS(11).cells(61, 10).value = "=J59-J60"
        wb.SHEETS(11).cells(61, 11).value = "=K59-K60"
        wb.SHEETS(11).cells(61, 12).value = "=L59-L60"
        wb.SHEETS(11).cells(61, 13).value = "=M59-M60"
        wb.SHEETS(11).cells(61, 14).value = "=N59-N60"
        wb.SHEETS(11).cells(61, 15).value = "=O59-O60"

        wb.SHEETS(11).cells(63, 3).value = "=C61-C62"
        wb.SHEETS(11).cells(63, 4).value = "=D61-D62"
        wb.SHEETS(11).cells(63, 5).value = "=E61-E62"
        wb.SHEETS(11).cells(63, 6).value = "=F61-F62"
        wb.SHEETS(11).cells(63, 7).value = "=G61-G62"
        wb.SHEETS(11).cells(63, 8).value = "=H61-H62"
        wb.SHEETS(11).cells(63, 9).value = "=I61-I62"
        wb.SHEETS(11).cells(63, 10).value = "=J61-J62"
        wb.SHEETS(11).cells(63, 11).value = "=K61-K62"
        wb.SHEETS(11).cells(63, 12).value = "=L61-L62"
        wb.SHEETS(11).cells(63, 13).value = "=M61-M62"
        wb.SHEETS(11).cells(63, 14).value = "=N61-N62"
        wb.SHEETS(11).cells(63, 15).value = "=O61-O62"

        wb.SHEETS(11).cells(9, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$L$10:$L$1000)"
        wb.SHEETS(11).cells(10, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$N$10:$N$1000)"
        wb.SHEETS(11).cells(11, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$O$10:$O$1000)"
        wb.SHEETS(11).cells(12, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$Q$10:$Q$1000)"
        wb.SHEETS(11).cells(13, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$R$10:$R$1000)"
        For I = Col + 1 To 14
            For J = 9 To 13
                wb.SHEETS(11).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(11).cells(18, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$V$10:$V$1000)"
        wb.SHEETS(11).cells(19, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$W$10:$W$1000)"
        wb.SHEETS(11).cells(20, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$X$10:$X$1000)"
        wb.SHEETS(11).cells(21, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$Z$10:$Z$1000)"
        wb.SHEETS(11).cells(22, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AB$10:$AB$1000)"
        wb.SHEETS(11).cells(23, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AD$10:$AD$1000)"
        wb.SHEETS(11).cells(24, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AF$10:$AF$1000)"
        For I = Col + 1 To 14
            For J = 18 To 24
                wb.SHEETS(11).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(11).cells(31, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AK$10:$AK$1000)"
        wb.SHEETS(11).cells(32, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AL$10:$AL$1000)"
        wb.SHEETS(11).cells(33, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AM$10:$AM$1000)"
        wb.SHEETS(11).cells(34, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AN$10:$AN$1000)"
        wb.SHEETS(11).cells(35, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AO$10:$AO$1000)"
        For I = Col + 1 To 14
            For J = 31 To 35
                wb.SHEETS(11).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(11).cells(42, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AT$10:$AT$1000)"
        For I = Col + 1 To 14
            For J = 42 To 42
                wb.SHEETS(11).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(11).cells(47, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AX$10:$AX$1000)"
        wb.SHEETS(11).cells(48, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AY$10:$AY$1000)"
        wb.SHEETS(11).cells(49, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AZ$10:$AZ$1000)"
        wb.SHEETS(11).cells(50, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BA$10:$BA$1000)"
        wb.SHEETS(11).cells(51, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BB$10:$BB$1000)"
        wb.SHEETS(11).cells(52, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BC$10:$BC$1000)"
        wb.SHEETS(11).cells(53, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BD$10:$BD$1000)"
        wb.SHEETS(11).cells(54, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BE$10:$BE$1000)"
        wb.SHEETS(11).cells(55, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BF$10:$BF$1000)"
        For I = Col + 1 To 14
            For J = 47 To 55
                wb.SHEETS(11).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(11).cells(60, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BK$10:$BK$1000)"
        For I = Col + 1 To 14
            For J = 60 To 60
                wb.SHEETS(11).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(11).cells(62, Col).value = "=SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BO$10:$BO$1000)"
        For I = Col + 1 To 14
            For J = 62 To 62
                wb.SHEETS(11).cells(J, I).value = 0
            Next
        Next

        wb.SHEETS(11).columns(2).columnwidth = 44
        For i = 3 To 15
            wb.SHEETS(11).columns(i).columnwidth = 12
            wb.SHEETS(11).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(11).name = "EDO Resultados Urbano"

    End Sub
    Sub ResultadosLCBAPI()
        Dim rng As Integer = 2
        
        wb.SHEETS(9).select()
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        wb.SHEETS(10).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(10).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(10).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(10).cells(rng, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(10).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(10).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(10).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(10).cells(rng, 2).value = "Estado de Resultados LCB-API"
        rng = rng + 2

        'AGREGA DEFINICIONES
        wb.SHEETS(10).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(10).cells(rng, 3).value = "ENERO"
        wb.SHEETS(10).cells(rng, 4).value = "FEBRERO"
        wb.SHEETS(10).cells(rng, 5).value = "MARZO"
        wb.SHEETS(10).cells(rng, 6).value = "ABRIL"
        wb.SHEETS(10).cells(rng, 7).value = "MAYO"
        wb.SHEETS(10).cells(rng, 8).value = "JUNIO"
        wb.SHEETS(10).cells(rng, 9).value = "JULIO"
        wb.SHEETS(10).cells(rng, 10).value = "AGOSTO"
        wb.SHEETS(10).cells(rng, 11).value = "SEPTIEMBRE"
        wb.SHEETS(10).cells(rng, 12).value = "OCTUBRE"
        wb.SHEETS(10).cells(rng, 13).value = "NOVIEMBRE"
        wb.SHEETS(10).cells(rng, 14).value = "DICIEMBRE"
        wb.SHEETS(10).cells(rng, 15).value = "ACUMULADO"

        For I = 2 To 15
            wb.SHEETS(10).cells(rng, I).font.bold = True
            wb.SHEETS(10).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(10).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(10).CELLS(rng, I).WrapText = True
            wb.SHEETS(10).CELLS(rng, I).Orientation = 0
            wb.SHEETS(10).CELLS(rng, I).AddIndent = False
            wb.SHEETS(10).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(10).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(10).CELLS(rng, I).MergeCells = False
            wb.SHEETS(10).CELLS(rng, I).ReadingOrder = -5002
        Next

        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(10).cells(9, 2).value = "Ingresos Boletos de Abordo"
        wb.SHEETS(10).cells(10, 2).value = "Ingresos Pagobus"
        wb.SHEETS(10).cells(11, 2).value = "Ingresos Red Integral Optibus"
        wb.SHEETS(10).cells(12, 2).value = "Otros Ingresos"
        wb.SHEETS(10).cells(13, 2).value = "Servicios Especiales"
        wb.SHEETS(10).cells(15, 2).value = "Total de Ingresos"


        wb.SHEETS(10).Range("C15:O15").INTERIOR.ThemeColor = 1
        wb.SHEETS(10).Range("C15:O15").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(10).Range("C26:O26").INTERIOR.ThemeColor = 1
        wb.SHEETS(10).Range("C26:O26").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(10).Range("C37:O37").INTERIOR.ThemeColor = 1
        wb.SHEETS(10).Range("C37:O37").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(10).Range("C57:O57").INTERIOR.ThemeColor = 1
        wb.SHEETS(10).Range("C57:O57").INTERIOR.TintAndShade = -0.0499893185216834

        wb.SHEETS(10).Range("C28:O28").INTERIOR.ThemeColor = 1
        wb.SHEETS(10).Range("C28:O28").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(10).Range("C39:O39").INTERIOR.ThemeColor = 1
        wb.SHEETS(10).Range("C39:O39").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(10).Range("C44:O44").INTERIOR.ThemeColor = 1
        wb.SHEETS(10).Range("C44:O44").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(10).Range("C59:O59").INTERIOR.ThemeColor = 1
        wb.SHEETS(10).Range("C59:O59").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(10).Range("C61:O61").INTERIOR.ThemeColor = 1
        wb.SHEETS(10).Range("C61:O61").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(10).Range("C63:O63").INTERIOR.ThemeColor = 1
        wb.SHEETS(10).Range("C63:O63").INTERIOR.TintAndShade = -0.149998474074526

        wb.SHEETS(10).cells(17, 2).value = "COSTOS DIRECTOS"
        wb.SHEETS(10).cells(18, 2).value = "Diesel"
        wb.SHEETS(10).cells(19, 2).value = "Sueldos y Salarios"
        wb.SHEETS(10).cells(20, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(10).cells(21, 2).value = "Refacciones"
        wb.SHEETS(10).cells(22, 2).value = "Mantenimiento y Reparación de Autobuses"
        wb.SHEETS(10).cells(23, 2).value = "Llantas Nuevas"
        wb.SHEETS(10).cells(24, 2).value = "Llantas Vitalizadas"
        wb.SHEETS(10).cells(26, 2).value = "Total de Costos Directos"

        wb.SHEETS(10).cells(28, 2).value = "UTILIDAD BRUTA"

        wb.SHEETS(10).cells(30, 2).value = "COSTOS INDIRECTOS DE OPERACIÓN"
        wb.SHEETS(10).cells(31, 2).value = "Gastos de Mantenimiento"
        wb.SHEETS(10).cells(32, 2).value = "Gastos de Operación y Servicios"
        wb.SHEETS(10).cells(33, 2).value = "Gastos de Seguro Interno"
        wb.SHEETS(10).cells(34, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(10).cells(35, 2).value = "Gastos Diversos de Operación"
        wb.SHEETS(10).cells(37, 2).value = "Total de Costos Indirectos"

        wb.SHEETS(10).cells(39, 2).value = "UTILIDAD MARGINAL"

        wb.SHEETS(10).cells(41, 2).value = "COSTOS INDIRECTOS DE ADMINISTRACIÓN"
        wb.SHEETS(10).cells(42, 2).value = "Gastos de Administración"

        wb.SHEETS(10).cells(44, 2).value = "UTILIDAD ANTES DE RESERVAS"

        wb.SHEETS(10).cells(46, 2).value = "RESERVAS"
        wb.SHEETS(10).cells(47, 2).value = "Reserva para Aguinaldo"
        wb.SHEETS(10).cells(48, 2).value = "Reserva para Tenencias y Refrendos"
        wb.SHEETS(10).cells(49, 2).value = "Reserva para Prima de Seguros"
        wb.SHEETS(10).cells(50, 2).value = "Fondo para Renovación de Equipo"
        wb.SHEETS(10).cells(51, 2).value = "Aportaciones al Fideicomiso"
        wb.SHEETS(10).cells(52, 2).value = "Reserva para Capacitación Adiestramiento Seguridad e Higiene y Otros"
        wb.SHEETS(10).cells(53, 2).value = "Reserva  PTU"
        wb.SHEETS(10).cells(54, 2).value = "Reserva para Uniformes y Otros Gastos Mayores"
        wb.SHEETS(10).cells(55, 2).value = "Reserva para Adquisición de Activos"

        wb.SHEETS(10).cells(57, 2).value = "Total de Reservas"

        wb.SHEETS(10).cells(59, 2).value = "RESULTADO ANTES DE DOCUMENTOS"
        wb.SHEETS(10).cells(60, 2).value = "Documento de Unidades"
        wb.SHEETS(10).cells(61, 2).value = "RESULTADO ANTES IMPUESTOS"
        wb.SHEETS(10).cells(62, 2).value = "Impuesto Sobre la Renta"
        wb.SHEETS(10).cells(63, 2).value = "RESULTADO NETO"

        For i = 9 To 63
            wb.SHEETS(10).cells(i, 15).value = "=SUMA(C" & i & ":N" & i & ")"
        Next
        wb.SHEETS(10).cells(16, 15).value = ""
        wb.SHEETS(10).cells(27, 15).value = ""
        wb.SHEETS(10).cells(29, 15).value = ""
        wb.SHEETS(10).cells(38, 15).value = ""
        wb.SHEETS(10).cells(40, 15).value = ""
        wb.SHEETS(10).cells(43, 15).value = ""
        wb.SHEETS(10).cells(45, 15).value = ""
        wb.SHEETS(10).cells(56, 15).value = ""
        wb.SHEETS(10).cells(58, 15).value = ""
        wb.SHEETS(10).cells(17, 15).value = ""
        wb.SHEETS(10).cells(30, 15).value = ""
        wb.SHEETS(10).cells(41, 15).value = ""
        wb.SHEETS(10).cells(46, 15).value = ""
        wb.SHEETS(10).cells(14, 15).value = ""
        wb.SHEETS(10).cells(25, 15).value = ""
        wb.SHEETS(10).cells(36, 15).value = ""

        wb.SHEETS(10).cells(15, 3).value = "=SUMA(C9:C14)"
        wb.SHEETS(10).cells(15, 4).value = "=SUMA(D9:D14)"
        wb.SHEETS(10).cells(15, 5).value = "=SUMA(E9:E14)"
        wb.SHEETS(10).cells(15, 6).value = "=SUMA(F9:F14)"
        wb.SHEETS(10).cells(15, 7).value = "=SUMA(G9:G14)"
        wb.SHEETS(10).cells(15, 8).value = "=SUMA(H9:H14)"
        wb.SHEETS(10).cells(15, 9).value = "=SUMA(I9:I14)"
        wb.SHEETS(10).cells(15, 10).value = "=SUMA(J9:J14)"
        wb.SHEETS(10).cells(15, 11).value = "=SUMA(K9:K14)"
        wb.SHEETS(10).cells(15, 12).value = "=SUMA(L9:L14)"
        wb.SHEETS(10).cells(15, 13).value = "=SUMA(M9:M14)"
        wb.SHEETS(10).cells(15, 14).value = "=SUMA(N9:N14)"
        wb.SHEETS(10).cells(15, 15).value = "=SUMA(O9:O14)"



        wb.SHEETS(10).cells(26, 3).value = "=SUMA(C18:C25)"
        wb.SHEETS(10).cells(26, 4).value = "=SUMA(D18:D25)"
        wb.SHEETS(10).cells(26, 5).value = "=SUMA(E18:E25)"
        wb.SHEETS(10).cells(26, 6).value = "=SUMA(F18:F25)"
        wb.SHEETS(10).cells(26, 7).value = "=SUMA(G18:G25)"
        wb.SHEETS(10).cells(26, 8).value = "=SUMA(H18:H25)"
        wb.SHEETS(10).cells(26, 9).value = "=SUMA(I18:I25)"
        wb.SHEETS(10).cells(26, 10).value = "=SUMA(J18:J25)"
        wb.SHEETS(10).cells(26, 11).value = "=SUMA(K18:K25)"
        wb.SHEETS(10).cells(26, 12).value = "=SUMA(L18:L25)"
        wb.SHEETS(10).cells(26, 13).value = "=SUMA(M18:M25)"
        wb.SHEETS(10).cells(26, 14).value = "=SUMA(N18:N25)"
        wb.SHEETS(10).cells(26, 15).value = "=SUMA(O18:O25)"

        wb.SHEETS(10).cells(28, 3).value = "=C15-C26"
        wb.SHEETS(10).cells(28, 4).value = "=D15-D26"
        wb.SHEETS(10).cells(28, 5).value = "=E15-E26"
        wb.SHEETS(10).cells(28, 6).value = "=F15-F26"
        wb.SHEETS(10).cells(28, 7).value = "=G15-G26"
        wb.SHEETS(10).cells(28, 8).value = "=H15-H26"
        wb.SHEETS(10).cells(28, 9).value = "=I15-I26"
        wb.SHEETS(10).cells(28, 10).value = "=J15-J26"
        wb.SHEETS(10).cells(28, 11).value = "=K15-K26"
        wb.SHEETS(10).cells(28, 12).value = "=L15-L26"
        wb.SHEETS(10).cells(28, 13).value = "=M15-M26"
        wb.SHEETS(10).cells(28, 14).value = "=N15-N26"
        wb.SHEETS(10).cells(28, 15).value = "=O15-O26"

        wb.SHEETS(10).cells(37, 3).value = "=SUMA(C31:C36)"
        wb.SHEETS(10).cells(37, 4).value = "=SUMA(D31:D36)"
        wb.SHEETS(10).cells(37, 5).value = "=SUMA(E31:E36)"
        wb.SHEETS(10).cells(37, 6).value = "=SUMA(F31:F36)"
        wb.SHEETS(10).cells(37, 7).value = "=SUMA(G31:G36)"
        wb.SHEETS(10).cells(37, 8).value = "=SUMA(H31:H36)"
        wb.SHEETS(10).cells(37, 9).value = "=SUMA(I31:I36)"
        wb.SHEETS(10).cells(37, 10).value = "=SUMA(J31:J36)"
        wb.SHEETS(10).cells(37, 11).value = "=SUMA(K31:K36)"
        wb.SHEETS(10).cells(37, 12).value = "=SUMA(L18:L36)"
        wb.SHEETS(10).cells(37, 13).value = "=SUMA(M31:M36)"
        wb.SHEETS(10).cells(37, 14).value = "=SUMA(N31:N36)"
        wb.SHEETS(10).cells(37, 15).value = "=SUMA(O31:O36)"

        wb.SHEETS(10).cells(39, 3).value = "=C28-C37"
        wb.SHEETS(10).cells(39, 4).value = "=D28-D37"
        wb.SHEETS(10).cells(39, 5).value = "=E28-E37"
        wb.SHEETS(10).cells(39, 6).value = "=F28-F37"
        wb.SHEETS(10).cells(39, 7).value = "=G28-G37"
        wb.SHEETS(10).cells(39, 8).value = "=H28-H37"
        wb.SHEETS(10).cells(39, 9).value = "=I28-I37"
        wb.SHEETS(10).cells(39, 10).value = "=J28-J37"
        wb.SHEETS(10).cells(39, 11).value = "=K28-K37"
        wb.SHEETS(10).cells(39, 12).value = "=L28-L37"
        wb.SHEETS(10).cells(39, 13).value = "=M28-M37"
        wb.SHEETS(10).cells(39, 14).value = "=N28-N37"
        wb.SHEETS(10).cells(39, 15).value = "=O28-O37"

        wb.SHEETS(10).cells(44, 3).value = "=C39-C42"
        wb.SHEETS(10).cells(44, 4).value = "=D39-D42"
        wb.SHEETS(10).cells(44, 5).value = "=E39-E42"
        wb.SHEETS(10).cells(44, 6).value = "=F39-F42"
        wb.SHEETS(10).cells(44, 7).value = "=G39-G42"
        wb.SHEETS(10).cells(44, 8).value = "=H39-H42"
        wb.SHEETS(10).cells(44, 9).value = "=I39-I42"
        wb.SHEETS(10).cells(44, 10).value = "=J39-J42"
        wb.SHEETS(10).cells(44, 11).value = "=K39-K42"
        wb.SHEETS(10).cells(44, 12).value = "=L39-L42"
        wb.SHEETS(10).cells(44, 13).value = "=M39-M42"
        wb.SHEETS(10).cells(44, 14).value = "=N39-N42"
        wb.SHEETS(10).cells(44, 15).value = "=O39-O42"

        wb.SHEETS(10).cells(57, 3).value = "=SUMA(C47:C56)"
        wb.SHEETS(10).cells(57, 4).value = "=SUMA(D47:D56)"
        wb.SHEETS(10).cells(57, 5).value = "=SUMA(E47:E56)"
        wb.SHEETS(10).cells(57, 6).value = "=SUMA(F47:F56)"
        wb.SHEETS(10).cells(57, 7).value = "=SUMA(G47:G56)"
        wb.SHEETS(10).cells(57, 8).value = "=SUMA(H47:H56)"
        wb.SHEETS(10).cells(57, 9).value = "=SUMA(I47:I56)"
        wb.SHEETS(10).cells(57, 10).value = "=SUMA(J47:J56)"
        wb.SHEETS(10).cells(57, 11).value = "=SUMA(K47:K56)"
        wb.SHEETS(10).cells(57, 12).value = "=SUMA(L47:L56)"
        wb.SHEETS(10).cells(57, 13).value = "=SUMA(M47:M56)"
        wb.SHEETS(10).cells(57, 14).value = "=SUMA(N47:N56)"
        wb.SHEETS(10).cells(57, 15).value = "=SUMA(O47:O56)"

        wb.SHEETS(10).cells(59, 3).value = "=C44-C57"
        wb.SHEETS(10).cells(59, 4).value = "=D44-D57"
        wb.SHEETS(10).cells(59, 5).value = "=E44-E57"
        wb.SHEETS(10).cells(59, 6).value = "=F44-F57"
        wb.SHEETS(10).cells(59, 7).value = "=G44-G57"
        wb.SHEETS(10).cells(59, 8).value = "=H44-H57"
        wb.SHEETS(10).cells(59, 9).value = "=I44-I57"
        wb.SHEETS(10).cells(59, 10).value = "=J44-J57"
        wb.SHEETS(10).cells(59, 11).value = "=K44-K57"
        wb.SHEETS(10).cells(59, 12).value = "=L44-L57"
        wb.SHEETS(10).cells(59, 13).value = "=M44-M57"
        wb.SHEETS(10).cells(59, 14).value = "=N44-N57"
        wb.SHEETS(10).cells(59, 15).value = "=O44-O57"

        wb.SHEETS(10).cells(61, 3).value = "=C59-C60"
        wb.SHEETS(10).cells(61, 4).value = "=D59-D60"
        wb.SHEETS(10).cells(61, 5).value = "=E59-E60"
        wb.SHEETS(10).cells(61, 6).value = "=F59-F60"
        wb.SHEETS(10).cells(61, 7).value = "=G59-G60"
        wb.SHEETS(10).cells(61, 8).value = "=H59-H60"
        wb.SHEETS(10).cells(61, 9).value = "=I59-I60"
        wb.SHEETS(10).cells(61, 10).value = "=J59-J60"
        wb.SHEETS(10).cells(61, 11).value = "=K59-K60"
        wb.SHEETS(10).cells(61, 12).value = "=L59-L60"
        wb.SHEETS(10).cells(61, 13).value = "=M59-M60"
        wb.SHEETS(10).cells(61, 14).value = "=N59-N60"
        wb.SHEETS(10).cells(61, 15).value = "=O59-O60"

        wb.SHEETS(10).cells(63, 3).value = "=C61-C62"
        wb.SHEETS(10).cells(63, 4).value = "=D61-D62"
        wb.SHEETS(10).cells(63, 5).value = "=E61-E62"
        wb.SHEETS(10).cells(63, 6).value = "=F61-F62"
        wb.SHEETS(10).cells(63, 7).value = "=G61-G62"
        wb.SHEETS(10).cells(63, 8).value = "=H61-H62"
        wb.SHEETS(10).cells(63, 9).value = "=I61-I62"
        wb.SHEETS(10).cells(63, 10).value = "=J61-J62"
        wb.SHEETS(10).cells(63, 11).value = "=K61-K62"
        wb.SHEETS(10).cells(63, 12).value = "=L61-L62"
        wb.SHEETS(10).cells(63, 13).value = "=M61-M62"
        wb.SHEETS(10).cells(63, 14).value = "=N61-N62"
        wb.SHEETS(10).cells(63, 15).value = "=O61-O62"

        wb.SHEETS(10).cells(9, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$L$10:$L$1000)*0.653831"
        wb.SHEETS(10).cells(10, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$N$10:$N$1000)*0.653831"
        wb.SHEETS(10).cells(11, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$O$10:$O$1000)*0.653831"
        wb.SHEETS(10).cells(12, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$Q$10:$Q$1000)*0.653831"
        wb.SHEETS(10).cells(13, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$R$10:$R$1000)*0.653831"
        For I = Col + 1 To 14
            For J = 9 To 13
                wb.SHEETS(10).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(10).cells(18, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$V$10:$V$1000)*0.653831"
        wb.SHEETS(10).cells(19, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$W$10:$W$1000)*0.653831"
        wb.SHEETS(10).cells(20, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$X$10:$X$1000)*0.653831"
        wb.SHEETS(10).cells(21, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$Z$10:$Z$1000)*0.653831"
        wb.SHEETS(10).cells(22, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AB$10:$AB$1000)*0.653831"
        wb.SHEETS(10).cells(23, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AD$10:$AD$1000)*0.653831"
        wb.SHEETS(10).cells(24, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AF$10:$AF$1000)*0.653831"
        For I = Col + 1 To 14
            For J = 18 To 24
                wb.SHEETS(10).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(10).cells(31, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AK$10:$AK$1000)*0.653831"
        wb.SHEETS(10).cells(32, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AL$10:$AL$1000)*0.653831"
        wb.SHEETS(10).cells(33, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AM$10:$AM$1000)*0.653831"
        wb.SHEETS(10).cells(34, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AN$10:$AN$1000)*0.653831"
        wb.SHEETS(10).cells(35, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AO$10:$AO$1000)*0.653831"
        For I = Col + 1 To 14
            For J = 31 To 35
                wb.SHEETS(10).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(10).cells(42, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AT$10:$AT$1000)*0.653831"
        For I = Col + 1 To 14
            For J = 42 To 42
                wb.SHEETS(10).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(10).cells(47, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AX$10:$AX$1000)*0.653831"
        wb.SHEETS(10).cells(48, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AY$10:$AY$1000)*0.653831"
        wb.SHEETS(10).cells(49, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$AZ$10:$AZ$1000)*0.653831"
        wb.SHEETS(10).cells(50, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$BA$10:$BA$1000)*0.653831"
        wb.SHEETS(10).cells(51, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$BB$10:$BB$1000)*0.653831"
        wb.SHEETS(10).cells(52, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$BC$10:$BC$1000)*0.653831"
        wb.SHEETS(10).cells(53, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$BD$10:$BD$1000)*0.653831"
        wb.SHEETS(10).cells(54, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$BE$10:$BE$1000)*0.653831"
        wb.SHEETS(10).cells(55, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$BF$10:$BF$1000)*0.653831"
        For I = Col + 1 To 14
            For J = 47 To 55
                wb.SHEETS(10).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(10).cells(60, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$BK$10:$BK$1000)*0.653831"
        For I = Col + 1 To 14
            For J = 60 To 60
                wb.SHEETS(10).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(10).cells(62, Col).value = "=SUMAR.SI(RPA!$B$10:$BO$1000," & Chr(34) & "Linea Centro Bellavista SA de CV" & Chr(34) & ",RPA!$BO$10:$BO$1000)*0.653831"
        For I = Col + 1 To 14
            For J = 62 To 62
                wb.SHEETS(10).cells(J, I).value = 0
            Next
        Next

        wb.SHEETS(10).columns(2).columnwidth = 44
        For i = 3 To 15
            wb.SHEETS(10).columns(i).columnwidth = 12
            wb.SHEETS(10).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(10).name = "EDO Resultados LCB API"
    End Sub
    Sub ResultadosAUSLAPI()
        Dim rng As Integer = 2

        wb.SHEETS(8).select()
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        wb.SHEETS(9).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(9).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(9).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(9).cells(rng, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(9).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(9).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(9).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(9).cells(rng, 2).value = "Estado de Resultados AUSL-API"
        rng = rng + 2

        'AGREGA DEFINICIONES
        wb.SHEETS(9).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(9).cells(rng, 3).value = "ENERO"
        wb.SHEETS(9).cells(rng, 4).value = "FEBRERO"
        wb.SHEETS(9).cells(rng, 5).value = "MARZO"
        wb.SHEETS(9).cells(rng, 6).value = "ABRIL"
        wb.SHEETS(9).cells(rng, 7).value = "MAYO"
        wb.SHEETS(9).cells(rng, 8).value = "JUNIO"
        wb.SHEETS(9).cells(rng, 9).value = "JULIO"
        wb.SHEETS(9).cells(rng, 10).value = "AGOSTO"
        wb.SHEETS(9).cells(rng, 11).value = "SEPTIEMBRE"
        wb.SHEETS(9).cells(rng, 12).value = "OCTUBRE"
        wb.SHEETS(9).cells(rng, 13).value = "NOVIEMBRE"
        wb.SHEETS(9).cells(rng, 14).value = "DICIEMBRE"
        wb.SHEETS(9).cells(rng, 15).value = "ACUMULADO"

        For I = 2 To 15
            wb.SHEETS(9).cells(rng, I).font.bold = True
            wb.SHEETS(9).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(9).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(9).CELLS(rng, I).WrapText = True
            wb.SHEETS(9).CELLS(rng, I).Orientation = 0
            wb.SHEETS(9).CELLS(rng, I).AddIndent = False
            wb.SHEETS(9).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(9).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(9).CELLS(rng, I).MergeCells = False
            wb.SHEETS(9).CELLS(rng, I).ReadingOrder = -5002
        Next

        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(9).cells(9, 2).value = "Ingresos Boletos de Abordo"
        wb.SHEETS(9).cells(10, 2).value = "Ingresos Pagobus"
        wb.SHEETS(9).cells(11, 2).value = "Ingresos Red Integral Optibus"
        wb.SHEETS(9).cells(12, 2).value = "Otros Ingresos"
        wb.SHEETS(9).cells(13, 2).value = "Servicios Especiales"
        wb.SHEETS(9).cells(15, 2).value = "Total de Ingresos"


        wb.SHEETS(9).Range("C15:O15").INTERIOR.ThemeColor = 1
        wb.SHEETS(9).Range("C15:O15").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(9).Range("C26:O26").INTERIOR.ThemeColor = 1
        wb.SHEETS(9).Range("C26:O26").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(9).Range("C37:O37").INTERIOR.ThemeColor = 1
        wb.SHEETS(9).Range("C37:O37").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(9).Range("C57:O57").INTERIOR.ThemeColor = 1
        wb.SHEETS(9).Range("C57:O57").INTERIOR.TintAndShade = -0.0499893185216834

        wb.SHEETS(9).Range("C28:O28").INTERIOR.ThemeColor = 1
        wb.SHEETS(9).Range("C28:O28").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(9).Range("C39:O39").INTERIOR.ThemeColor = 1
        wb.SHEETS(9).Range("C39:O39").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(9).Range("C44:O44").INTERIOR.ThemeColor = 1
        wb.SHEETS(9).Range("C44:O44").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(9).Range("C59:O59").INTERIOR.ThemeColor = 1
        wb.SHEETS(9).Range("C59:O59").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(9).Range("C61:O61").INTERIOR.ThemeColor = 1
        wb.SHEETS(9).Range("C61:O61").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(9).Range("C63:O63").INTERIOR.ThemeColor = 1
        wb.SHEETS(9).Range("C63:O63").INTERIOR.TintAndShade = -0.149998474074526

        wb.SHEETS(9).cells(17, 2).value = "COSTOS DIRECTOS"
        wb.SHEETS(9).cells(18, 2).value = "Diesel"
        wb.SHEETS(9).cells(19, 2).value = "Sueldos y Salarios"
        wb.SHEETS(9).cells(20, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(9).cells(21, 2).value = "Refacciones"
        wb.SHEETS(9).cells(22, 2).value = "Mantenimiento y Reparación de Autobuses"
        wb.SHEETS(9).cells(23, 2).value = "Llantas Nuevas"
        wb.SHEETS(9).cells(24, 2).value = "Llantas Vitalizadas"
        wb.SHEETS(9).cells(26, 2).value = "Total de Costos Directos"

        wb.SHEETS(9).cells(28, 2).value = "UTILIDAD BRUTA"

        wb.SHEETS(9).cells(30, 2).value = "COSTOS INDIRECTOS DE OPERACIÓN"
        wb.SHEETS(9).cells(31, 2).value = "Gastos de Mantenimiento"
        wb.SHEETS(9).cells(32, 2).value = "Gastos de Operación y Servicios"
        wb.SHEETS(9).cells(33, 2).value = "Gastos de Seguro Interno"
        wb.SHEETS(9).cells(34, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(9).cells(35, 2).value = "Gastos Diversos de Operación"
        wb.SHEETS(9).cells(37, 2).value = "Total de Costos Indirectos"

        wb.SHEETS(9).cells(39, 2).value = "UTILIDAD MARGINAL"

        wb.SHEETS(9).cells(41, 2).value = "COSTOS INDIRECTOS DE ADMINISTRACIÓN"
        wb.SHEETS(9).cells(42, 2).value = "Gastos de Administración"

        wb.SHEETS(9).cells(44, 2).value = "UTILIDAD ANTES DE RESERVAS"

        wb.SHEETS(9).cells(46, 2).value = "RESERVAS"
        wb.SHEETS(9).cells(47, 2).value = "Reserva para Aguinaldo"
        wb.SHEETS(9).cells(48, 2).value = "Reserva para Tenencias y Refrendos"
        wb.SHEETS(9).cells(49, 2).value = "Reserva para Prima de Seguros"
        wb.SHEETS(9).cells(50, 2).value = "Fondo para Renovación de Equipo"
        wb.SHEETS(9).cells(51, 2).value = "Aportaciones al Fideicomiso"
        wb.SHEETS(9).cells(52, 2).value = "Reserva para Capacitación Adiestramiento Seguridad e Higiene y Otros"
        wb.SHEETS(9).cells(53, 2).value = "Reserva  PTU"
        wb.SHEETS(9).cells(54, 2).value = "Reserva para Uniformes y Otros Gastos Mayores"
        wb.SHEETS(9).cells(55, 2).value = "Reserva para Adquisición de Activos"

        wb.SHEETS(9).cells(57, 2).value = "Total de Reservas"

        wb.SHEETS(9).cells(59, 2).value = "RESULTADO ANTES DE DOCUMENTOS"
        wb.SHEETS(9).cells(60, 2).value = "Documento de Unidades"
        wb.SHEETS(9).cells(61, 2).value = "RESULTADO ANTES IMPUESTOS"
        wb.SHEETS(9).cells(62, 2).value = "Impuesto Sobre la Renta"
        wb.SHEETS(9).cells(63, 2).value = "RESULTADO NETO"

        For i = 9 To 63
            wb.SHEETS(9).cells(i, 15).value = "=SUMA(C" & i & ":N" & i & ")"
        Next
        wb.SHEETS(9).cells(16, 15).value = ""
        wb.SHEETS(9).cells(27, 15).value = ""
        wb.SHEETS(9).cells(29, 15).value = ""
        wb.SHEETS(9).cells(38, 15).value = ""
        wb.SHEETS(9).cells(40, 15).value = ""
        wb.SHEETS(9).cells(43, 15).value = ""
        wb.SHEETS(9).cells(45, 15).value = ""
        wb.SHEETS(9).cells(56, 15).value = ""
        wb.SHEETS(9).cells(58, 15).value = ""
        wb.SHEETS(9).cells(17, 15).value = ""
        wb.SHEETS(9).cells(30, 15).value = ""
        wb.SHEETS(9).cells(41, 15).value = ""
        wb.SHEETS(9).cells(46, 15).value = ""
        wb.SHEETS(9).cells(14, 15).value = ""
        wb.SHEETS(9).cells(25, 15).value = ""
        wb.SHEETS(9).cells(36, 15).value = ""

        wb.SHEETS(9).cells(15, 3).value = "=SUMA(C9:C14)"
        wb.SHEETS(9).cells(15, 4).value = "=SUMA(D9:D14)"
        wb.SHEETS(9).cells(15, 5).value = "=SUMA(E9:E14)"
        wb.SHEETS(9).cells(15, 6).value = "=SUMA(F9:F14)"
        wb.SHEETS(9).cells(15, 7).value = "=SUMA(G9:G14)"
        wb.SHEETS(9).cells(15, 8).value = "=SUMA(H9:H14)"
        wb.SHEETS(9).cells(15, 9).value = "=SUMA(I9:I14)"
        wb.SHEETS(9).cells(15, 10).value = "=SUMA(J9:J14)"
        wb.SHEETS(9).cells(15, 11).value = "=SUMA(K9:K14)"
        wb.SHEETS(9).cells(15, 12).value = "=SUMA(L9:L14)"
        wb.SHEETS(9).cells(15, 13).value = "=SUMA(M9:M14)"
        wb.SHEETS(9).cells(15, 14).value = "=SUMA(N9:N14)"
        wb.SHEETS(9).cells(15, 15).value = "=SUMA(O9:O14)"



        wb.SHEETS(9).cells(26, 3).value = "=SUMA(C18:C25)"
        wb.SHEETS(9).cells(26, 4).value = "=SUMA(D18:D25)"
        wb.SHEETS(9).cells(26, 5).value = "=SUMA(E18:E25)"
        wb.SHEETS(9).cells(26, 6).value = "=SUMA(F18:F25)"
        wb.SHEETS(9).cells(26, 7).value = "=SUMA(G18:G25)"
        wb.SHEETS(9).cells(26, 8).value = "=SUMA(H18:H25)"
        wb.SHEETS(9).cells(26, 9).value = "=SUMA(I18:I25)"
        wb.SHEETS(9).cells(26, 10).value = "=SUMA(J18:J25)"
        wb.SHEETS(9).cells(26, 11).value = "=SUMA(K18:K25)"
        wb.SHEETS(9).cells(26, 12).value = "=SUMA(L18:L25)"
        wb.SHEETS(9).cells(26, 13).value = "=SUMA(M18:M25)"
        wb.SHEETS(9).cells(26, 14).value = "=SUMA(N18:N25)"
        wb.SHEETS(9).cells(26, 15).value = "=SUMA(O18:O25)"

        wb.SHEETS(9).cells(28, 3).value = "=C15-C26"
        wb.SHEETS(9).cells(28, 4).value = "=D15-D26"
        wb.SHEETS(9).cells(28, 5).value = "=E15-E26"
        wb.SHEETS(9).cells(28, 6).value = "=F15-F26"
        wb.SHEETS(9).cells(28, 7).value = "=G15-G26"
        wb.SHEETS(9).cells(28, 8).value = "=H15-H26"
        wb.SHEETS(9).cells(28, 9).value = "=I15-I26"
        wb.SHEETS(9).cells(28, 10).value = "=J15-J26"
        wb.SHEETS(9).cells(28, 11).value = "=K15-K26"
        wb.SHEETS(9).cells(28, 12).value = "=L15-L26"
        wb.SHEETS(9).cells(28, 13).value = "=M15-M26"
        wb.SHEETS(9).cells(28, 14).value = "=N15-N26"
        wb.SHEETS(9).cells(28, 15).value = "=O15-O26"

        wb.SHEETS(9).cells(37, 3).value = "=SUMA(C31:C36)"
        wb.SHEETS(9).cells(37, 4).value = "=SUMA(D31:D36)"
        wb.SHEETS(9).cells(37, 5).value = "=SUMA(E31:E36)"
        wb.SHEETS(9).cells(37, 6).value = "=SUMA(F31:F36)"
        wb.SHEETS(9).cells(37, 7).value = "=SUMA(G31:G36)"
        wb.SHEETS(9).cells(37, 8).value = "=SUMA(H31:H36)"
        wb.SHEETS(9).cells(37, 9).value = "=SUMA(I31:I36)"
        wb.SHEETS(9).cells(37, 10).value = "=SUMA(J31:J36)"
        wb.SHEETS(9).cells(37, 11).value = "=SUMA(K31:K36)"
        wb.SHEETS(9).cells(37, 12).value = "=SUMA(L18:L36)"
        wb.SHEETS(9).cells(37, 13).value = "=SUMA(M31:M36)"
        wb.SHEETS(9).cells(37, 14).value = "=SUMA(N31:N36)"
        wb.SHEETS(9).cells(37, 15).value = "=SUMA(O31:O36)"

        wb.SHEETS(9).cells(39, 3).value = "=C28-C37"
        wb.SHEETS(9).cells(39, 4).value = "=D28-D37"
        wb.SHEETS(9).cells(39, 5).value = "=E28-E37"
        wb.SHEETS(9).cells(39, 6).value = "=F28-F37"
        wb.SHEETS(9).cells(39, 7).value = "=G28-G37"
        wb.SHEETS(9).cells(39, 8).value = "=H28-H37"
        wb.SHEETS(9).cells(39, 9).value = "=I28-I37"
        wb.SHEETS(9).cells(39, 10).value = "=J28-J37"
        wb.SHEETS(9).cells(39, 11).value = "=K28-K37"
        wb.SHEETS(9).cells(39, 12).value = "=L28-L37"
        wb.SHEETS(9).cells(39, 13).value = "=M28-M37"
        wb.SHEETS(9).cells(39, 14).value = "=N28-N37"
        wb.SHEETS(9).cells(39, 15).value = "=O28-O37"

        wb.SHEETS(9).cells(44, 3).value = "=C39-C42"
        wb.SHEETS(9).cells(44, 4).value = "=D39-D42"
        wb.SHEETS(9).cells(44, 5).value = "=E39-E42"
        wb.SHEETS(9).cells(44, 6).value = "=F39-F42"
        wb.SHEETS(9).cells(44, 7).value = "=G39-G42"
        wb.SHEETS(9).cells(44, 8).value = "=H39-H42"
        wb.SHEETS(9).cells(44, 9).value = "=I39-I42"
        wb.SHEETS(9).cells(44, 10).value = "=J39-J42"
        wb.SHEETS(9).cells(44, 11).value = "=K39-K42"
        wb.SHEETS(9).cells(44, 12).value = "=L39-L42"
        wb.SHEETS(9).cells(44, 13).value = "=M39-M42"
        wb.SHEETS(9).cells(44, 14).value = "=N39-N42"
        wb.SHEETS(9).cells(44, 15).value = "=O39-O42"

        wb.SHEETS(9).cells(57, 3).value = "=SUMA(C47:C56)"
        wb.SHEETS(9).cells(57, 4).value = "=SUMA(D47:D56)"
        wb.SHEETS(9).cells(57, 5).value = "=SUMA(E47:E56)"
        wb.SHEETS(9).cells(57, 6).value = "=SUMA(F47:F56)"
        wb.SHEETS(9).cells(57, 7).value = "=SUMA(G47:G56)"
        wb.SHEETS(9).cells(57, 8).value = "=SUMA(H47:H56)"
        wb.SHEETS(9).cells(57, 9).value = "=SUMA(I47:I56)"
        wb.SHEETS(9).cells(57, 10).value = "=SUMA(J47:J56)"
        wb.SHEETS(9).cells(57, 11).value = "=SUMA(K47:K56)"
        wb.SHEETS(9).cells(57, 12).value = "=SUMA(L47:L56)"
        wb.SHEETS(9).cells(57, 13).value = "=SUMA(M47:M56)"
        wb.SHEETS(9).cells(57, 14).value = "=SUMA(N47:N56)"
        wb.SHEETS(9).cells(57, 15).value = "=SUMA(O47:O56)"

        wb.SHEETS(9).cells(59, 3).value = "=C44-C57"
        wb.SHEETS(9).cells(59, 4).value = "=D44-D57"
        wb.SHEETS(9).cells(59, 5).value = "=E44-E57"
        wb.SHEETS(9).cells(59, 6).value = "=F44-F57"
        wb.SHEETS(9).cells(59, 7).value = "=G44-G57"
        wb.SHEETS(9).cells(59, 8).value = "=H44-H57"
        wb.SHEETS(9).cells(59, 9).value = "=I44-I57"
        wb.SHEETS(9).cells(59, 10).value = "=J44-J57"
        wb.SHEETS(9).cells(59, 11).value = "=K44-K57"
        wb.SHEETS(9).cells(59, 12).value = "=L44-L57"
        wb.SHEETS(9).cells(59, 13).value = "=M44-M57"
        wb.SHEETS(9).cells(59, 14).value = "=N44-N57"
        wb.SHEETS(9).cells(59, 15).value = "=O44-O57"

        wb.SHEETS(9).cells(61, 3).value = "=C59-C60"
        wb.SHEETS(9).cells(61, 4).value = "=D59-D60"
        wb.SHEETS(9).cells(61, 5).value = "=E59-E60"
        wb.SHEETS(9).cells(61, 6).value = "=F59-F60"
        wb.SHEETS(9).cells(61, 7).value = "=G59-G60"
        wb.SHEETS(9).cells(61, 8).value = "=H59-H60"
        wb.SHEETS(9).cells(61, 9).value = "=I59-I60"
        wb.SHEETS(9).cells(61, 10).value = "=J59-J60"
        wb.SHEETS(9).cells(61, 11).value = "=K59-K60"
        wb.SHEETS(9).cells(61, 12).value = "=L59-L60"
        wb.SHEETS(9).cells(61, 13).value = "=M59-M60"
        wb.SHEETS(9).cells(61, 14).value = "=N59-N60"
        wb.SHEETS(9).cells(61, 15).value = "=O59-O60"

        wb.SHEETS(9).cells(63, 3).value = "=C61-C62"
        wb.SHEETS(9).cells(63, 4).value = "=D61-D62"
        wb.SHEETS(9).cells(63, 5).value = "=E61-E62"
        wb.SHEETS(9).cells(63, 6).value = "=F61-F62"
        wb.SHEETS(9).cells(63, 7).value = "=G61-G62"
        wb.SHEETS(9).cells(63, 8).value = "=H61-H62"
        wb.SHEETS(9).cells(63, 9).value = "=I61-I62"
        wb.SHEETS(9).cells(63, 10).value = "=J61-J62"
        wb.SHEETS(9).cells(63, 11).value = "=K61-K62"
        wb.SHEETS(9).cells(63, 12).value = "=L61-L62"
        wb.SHEETS(9).cells(63, 13).value = "=M61-M62"
        wb.SHEETS(9).cells(63, 14).value = "=N61-N62"
        wb.SHEETS(9).cells(63, 15).value = "=O61-O62"

        wb.SHEETS(9).cells(9, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$L$10:$L$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$L$10:$L$1000))"
        wb.SHEETS(9).cells(10, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$N$10:$N$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$N$10:$N$1000))"
        wb.SHEETS(9).cells(11, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$O$10:$O$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$O$10:$O$1000))"
        wb.SHEETS(9).cells(12, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$Q$10:$Q$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$Q$10:$Q$1000))"
        wb.SHEETS(9).cells(13, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$R$10:$R$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$R$10:$R$1000))"
        For I = Col + 1 To 14
            For J = 9 To 13
                wb.SHEETS(9).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(9).cells(18, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$V$10:$V$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$V$10:$V$1000))"
        wb.SHEETS(9).cells(19, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$W$10:$W$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$W$10:$W$1000))"
        wb.SHEETS(9).cells(20, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$X$10:$X$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$X$10:$X$1000))"
        wb.SHEETS(9).cells(21, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$Z$10:$Z$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$Z$10:$Z$1000))"
        wb.SHEETS(9).cells(22, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AB$10:$AB$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AB$10:$AB$1000))"
        wb.SHEETS(9).cells(23, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AD$10:$AD$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AD$10:$AD$1000))"
        wb.SHEETS(9).cells(24, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AF$10:$AF$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AF$10:$AF$1000))"
        For I = Col + 1 To 14
            For J = 18 To 24
                wb.SHEETS(9).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(9).cells(31, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AK$10:$AK$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AK$10:$AK$1000))"
        wb.SHEETS(9).cells(32, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AL$10:$AL$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AL$10:$AL$1000))"
        wb.SHEETS(9).cells(33, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AM$10:$AM$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AM$10:$AM$1000))"
        wb.SHEETS(9).cells(34, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AN$10:$AN$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AN$10:$AN$1000))"
        wb.SHEETS(9).cells(35, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AO$10:$AO$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AO$10:$AO$1000))"
        For I = Col + 1 To 14
            For J = 31 To 35
                wb.SHEETS(9).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(9).cells(42, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AT$10:$AT$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AT$10:$AT$1000))"
        For I = Col + 1 To 14
            For J = 42 To 42
                wb.SHEETS(9).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(9).cells(47, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AX$10:$AX$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AX$10:$AX$1000))"
        wb.SHEETS(9).cells(48, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AY$10:$AY$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AY$10:$AY$1000))"
        wb.SHEETS(9).cells(49, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AZ$10:$AZ$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AZ$10:$AZ$1000))"
        wb.SHEETS(9).cells(50, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BA$10:$BA$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BA$10:$BA$1000))"
        wb.SHEETS(9).cells(51, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BB$10:$BB$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BB$10:$BB$1000))"
        wb.SHEETS(9).cells(52, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BC$10:$BC$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BC$10:$BC$1000))"
        wb.SHEETS(9).cells(53, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BD$10:$BD$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BD$10:$BD$1000))"
        wb.SHEETS(9).cells(54, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BE$10:$BE$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BE$10:$BE$1000))"
        wb.SHEETS(9).cells(55, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BF$10:$BF$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BF$10:$BF$1000))"
        For I = Col + 1 To 14
            For J = 47 To 55
                wb.SHEETS(9).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(9).cells(60, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BK$10:$BK$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BK$10:$BK$1000))"
        For I = Col + 1 To 14
            For J = 60 To 60
                wb.SHEETS(9).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(9).cells(62, Col).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BO$10:$BO$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BO$10:$BO$1000))"
        For I = Col + 1 To 14
            For J = 62 To 62
                wb.SHEETS(9).cells(J, I).value = 0
            Next
        Next

        wb.SHEETS(9).columns(2).columnwidth = 44
        For i = 3 To 15
            wb.SHEETS(9).columns(i).columnwidth = 12
            wb.SHEETS(9).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(9).name = "EDO Resultados AUSL API"


    End Sub
    Sub ResultadosKmsEmpresa()
        Dim rng As Integer = 2

        wb.SHEETS(13).select()
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        wb.SHEETS(14).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(14).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(14).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(14).cells(1, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(14).cells(1, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(14).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(14).cells(rng, 2).FONT.SIZE = 12
        wb.SHEETS(14).cells(2, 2).value = "Autobuses Urbanos y Suburbanos de Leon SA de CV"
        wb.SHEETS(14).cells(2, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(14).cells(rng, 2).value = "Estado de Resultados por Kilometros por Empresa"
        rng = rng + 2

        wb.SHEETS(14).cells(4, 5).value = "Kilometros"
        wb.SHEETS(14).cells(5, 5).value = "Autobuses"

        For I = 4 To 5
            For j = 5 To 6
                wb.SHEETS(14).cells(I, j).font.bold = True
                wb.SHEETS(14).CELLS(I, j).HorizontalAlignment = -4108
                wb.SHEETS(14).CELLS(I, j).VerticalAlignment = -4108
                wb.SHEETS(14).CELLS(I, j).WrapText = True
                wb.SHEETS(14).CELLS(I, j).Orientation = 0
                wb.SHEETS(14).CELLS(I, j).AddIndent = False
                wb.SHEETS(14).CELLS(I, j).IndentLevel = 0
                wb.SHEETS(14).CELLS(I, j).ShrinkToFit = False
                wb.SHEETS(14).CELLS(I, j).MergeCells = False
                wb.SHEETS(14).CELLS(I, j).ReadingOrder = -5002
            Next
        Next

        wb.SHEETS(14).Range("E4:F5").INTERIOR.ThemeColor = 1
        wb.SHEETS(14).Range("E4:F5").INTERIOR.TintAndShade = -0.0499893185216834


        'AGREGA DEFINICIONES
        wb.SHEETS(14).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(14).cells(rng, 3).value = "TOTAL"
        wb.SHEETS(14).cells(rng, 4).value = "%ING"
        wb.SHEETS(14).cells(rng, 5).value = "POR AUTOBUS"
        wb.SHEETS(14).cells(rng, 6).value = "POR KMS RECORRIDO"


        For I = 2 To 6
            wb.SHEETS(14).cells(rng, I).font.bold = True
            wb.SHEETS(14).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(14).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(14).CELLS(rng, I).WrapText = True
            wb.SHEETS(14).CELLS(rng, I).Orientation = 0
            wb.SHEETS(14).CELLS(rng, I).AddIndent = False
            wb.SHEETS(14).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(14).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(14).CELLS(rng, I).MergeCells = False
            wb.SHEETS(14).CELLS(rng, I).ReadingOrder = -5002
        Next



        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(14).cells(9, 2).value = "Ingresos Boletos de Abordo"
        wb.SHEETS(14).cells(10, 2).value = "Ingresos Pagobus"
        wb.SHEETS(14).cells(11, 2).value = "Ingresos Red Integral Optibus"
        wb.SHEETS(14).cells(12, 2).value = "Otros Ingresos"
        wb.SHEETS(14).cells(13, 2).value = "Servicios Especiales"
        wb.SHEETS(14).cells(15, 2).value = "Total de Ingresos"


        wb.SHEETS(14).Range("C15:F15").INTERIOR.ThemeColor = 1
        wb.SHEETS(14).Range("C15:F15").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(14).Range("C26:F26").INTERIOR.ThemeColor = 1
        wb.SHEETS(14).Range("C26:F26").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(14).Range("C37:F37").INTERIOR.ThemeColor = 1
        wb.SHEETS(14).Range("C37:F37").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(14).Range("C57:F57").INTERIOR.ThemeColor = 1
        wb.SHEETS(14).Range("C57:F57").INTERIOR.TintAndShade = -0.0499893185216834

        wb.SHEETS(14).Range("C28:F28").INTERIOR.ThemeColor = 1
        wb.SHEETS(14).Range("C28:F28").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(14).Range("C39:F39").INTERIOR.ThemeColor = 1
        wb.SHEETS(14).Range("C39:F39").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(14).Range("C44:F44").INTERIOR.ThemeColor = 1
        wb.SHEETS(14).Range("C44:F44").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(14).Range("C59:FO59").INTERIOR.ThemeColor = 1
        wb.SHEETS(14).Range("C59:F59").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(14).Range("C61:F61").INTERIOR.ThemeColor = 1
        wb.SHEETS(14).Range("C61:F61").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(14).Range("C63:F63").INTERIOR.ThemeColor = 1
        wb.SHEETS(14).Range("C63:F63").INTERIOR.TintAndShade = -0.149998474074526

        wb.SHEETS(14).cells(17, 2).value = "COSTOS DIRECTOS"
        wb.SHEETS(14).cells(18, 2).value = "Diesel"
        wb.SHEETS(14).cells(19, 2).value = "Sueldos y Salarios"
        wb.SHEETS(14).cells(20, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(14).cells(21, 2).value = "Refacciones"
        wb.SHEETS(14).cells(22, 2).value = "Mantenimiento y Reparación de Autobuses"
        wb.SHEETS(14).cells(23, 2).value = "Llantas Nuevas"
        wb.SHEETS(14).cells(24, 2).value = "Llantas Vitalizadas"
        wb.SHEETS(14).cells(26, 2).value = "Total de Costos Directos"

        wb.SHEETS(14).cells(28, 2).value = "UTILIDAD BRUTA"

        wb.SHEETS(14).cells(30, 2).value = "COSTOS INDIRECTOS DE OPERACIÓN"
        wb.SHEETS(14).cells(31, 2).value = "Gastos de Mantenimiento"
        wb.SHEETS(14).cells(32, 2).value = "Gastos de Operación y Servicios"
        wb.SHEETS(14).cells(33, 2).value = "Gastos de Seguro Interno"
        wb.SHEETS(14).cells(34, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(14).cells(35, 2).value = "Gastos Diversos de Operación"
        wb.SHEETS(14).cells(37, 2).value = "Total de Costos Indirectos"

        wb.SHEETS(14).cells(39, 2).value = "UTILIDAD MARGINAL"

        wb.SHEETS(14).cells(41, 2).value = "COSTOS INDIRECTOS DE ADMINISTRACIÓN"
        wb.SHEETS(14).cells(42, 2).value = "Gastos de Administración"

        wb.SHEETS(14).cells(44, 2).value = "UTILIDAD ANTES DE RESERVAS"

        wb.SHEETS(14).cells(46, 2).value = "RESERVAS"
        wb.SHEETS(14).cells(47, 2).value = "Reserva para Aguinaldo"
        wb.SHEETS(14).cells(48, 2).value = "Reserva para Tenencias y Refrendos"
        wb.SHEETS(14).cells(49, 2).value = "Reserva para Prima de Seguros"
        wb.SHEETS(14).cells(50, 2).value = "Fondo para Renovación de Equipo"
        wb.SHEETS(14).cells(51, 2).value = "Aportaciones al Fideicomiso"
        wb.SHEETS(14).cells(52, 2).value = "Reserva para Capacitación Adiestramiento Seguridad e Higiene y Otros"
        wb.SHEETS(14).cells(53, 2).value = "Reserva  PTU"
        wb.SHEETS(14).cells(54, 2).value = "Reserva para Uniformes y Otros Gastos Mayores"
        wb.SHEETS(14).cells(55, 2).value = "Reserva para Adquisición de Activos"

        wb.SHEETS(14).cells(57, 2).value = "Total de Reservas"

        wb.SHEETS(14).cells(59, 2).value = "RESULTADO ANTES DE DOCUMENTOS"
        wb.SHEETS(14).cells(60, 2).value = "Documento de Unidades"
        wb.SHEETS(14).cells(61, 2).value = "RESULTADO ANTES IMPUESTOS"
        wb.SHEETS(14).cells(62, 2).value = "Impuesto Sobre la Renta"
        wb.SHEETS(14).cells(63, 2).value = "RESULTADO NETO"

        wb.SHEETS(14).cells(15, 3).value = "=SUMA(C9:C14)"
        wb.SHEETS(14).cells(26, 3).value = "=SUMA(C18:C25)"
        wb.SHEETS(14).cells(28, 3).value = "=C15-C26"
        wb.SHEETS(14).cells(37, 3).value = "=SUMA(C31:C36)"
        wb.SHEETS(14).cells(39, 3).value = "=C28-C37"
        wb.SHEETS(14).cells(44, 3).value = "=C39-C42"
        wb.SHEETS(14).cells(57, 3).value = "=SUMA(C47:C56)"
        wb.SHEETS(14).cells(59, 3).value = "=C44-C57"
        wb.SHEETS(14).cells(61, 3).value = "=C59-C60"
        wb.SHEETS(14).cells(63, 3).value = "=C61-C62"

        wb.SHEETS(14).cells(4, 6).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$G$10:$G$1000)"
        wb.SHEETS(14).cells(5, 6).value = "=RPA!E1+RPA!E2"

        wb.SHEETS(14).cells(9, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$L$10:$L$1000)"
        wb.SHEETS(14).cells(10, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$N$10:$N$1000)"
        wb.SHEETS(14).cells(11, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$O$10:$O$1000)"
        wb.SHEETS(14).cells(12, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$Q$10:$Q$1000)"
        wb.SHEETS(14).cells(13, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$R$10:$R$1000)"
        wb.SHEETS(14).cells(18, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$V$10:$V$1000)"
        wb.SHEETS(14).cells(19, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$W$10:$W$1000)"
        wb.SHEETS(14).cells(20, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$X$10:$X$1000)"
        wb.SHEETS(14).cells(21, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$Z$10:$Z$1000)"
        wb.SHEETS(14).cells(22, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AB$10:$AB$1000)"
        wb.SHEETS(14).cells(23, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AD$10:$AD$1000)"
        wb.SHEETS(14).cells(24, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AF$10:$AF$1000)"
        wb.SHEETS(14).cells(31, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AK$10:$AK$1000)"
        wb.SHEETS(14).cells(32, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AL$10:$AL$1000)"
        wb.SHEETS(14).cells(33, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AM$10:$AM$1000)"
        wb.SHEETS(14).cells(34, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AN$10:$AN$1000)"
        wb.SHEETS(14).cells(35, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AO$10:$AO$1000)"
        wb.SHEETS(14).cells(42, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AT$10:$AT$1000)"
        wb.SHEETS(14).cells(47, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AX$10:$AX$1000)"
        wb.SHEETS(14).cells(48, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AY$10:$AY$1000)"
        wb.SHEETS(14).cells(49, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$AZ$10:$AZ$1000)"
        wb.SHEETS(14).cells(50, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BA$10:$BA$1000)"
        wb.SHEETS(14).cells(51, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BB$10:$BB$1000)"
        wb.SHEETS(14).cells(52, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BC$10:$BC$1000)"
        wb.SHEETS(14).cells(53, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BD$10:$BD$1000)"
        wb.SHEETS(14).cells(54, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BE$10:$BE$1000)"
        wb.SHEETS(14).cells(55, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BF$10:$BF$1000)"
        wb.SHEETS(14).cells(60, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BK$10:$BK$1000)"
        wb.SHEETS(14).cells(62, 3).value = "=SUMAR.SI(RPA!$B$10:$BO$1000,B2,RPA!$BO$10:$BO$1000)"

        wb.SHEETS(14).cells(9, 4).value = "=SI(ESERROR(C9*1/C15),0,C9*1/C15)"
        wb.SHEETS(14).cells(10, 4).value = "=SI(ESERROR(C10*1/C15),0,C10*1/C15)"
        wb.SHEETS(14).cells(11, 4).value = "=SI(ESERROR(C11*1/C15),0,C11*1/C15)"
        wb.SHEETS(14).cells(12, 4).value = "=SI(ESERROR(C12*1/C15),0,C12*1/C15)"
        wb.SHEETS(14).cells(13, 4).value = "=SI(ESERROR(C13*1/C15),0,C13*1/C15)"
        wb.SHEETS(14).cells(15, 4).value = "=SI(ESERROR(C15*1/C15),0,C15*1/C15)"
        wb.SHEETS(14).cells(18, 4).value = "=SI(ESERROR(C18*1/C15),0,C18*1/C15)"
        wb.SHEETS(14).cells(19, 4).value = "=SI(ESERROR(C19*1/C15),0,C19*1/C15)"
        wb.SHEETS(14).cells(20, 4).value = "=SI(ESERROR(C20*1/C15),0,C20*1/C15)"
        wb.SHEETS(14).cells(21, 4).value = "=SI(ESERROR(C21*1/C15),0,C21*1/C15)"
        wb.SHEETS(14).cells(22, 4).value = "=SI(ESERROR(C22*1/C15),0,C22*1/C15)"
        wb.SHEETS(14).cells(23, 4).value = "=SI(ESERROR(C23*1/C15),0,C23*1/C15)"
        wb.SHEETS(14).cells(24, 4).value = "=SI(ESERROR(C24*1/C15),0,C24*1/C15)"
        wb.SHEETS(14).cells(26, 4).value = "=SI(ESERROR(C26*1/C15),0,C26*1/C15)"
        wb.SHEETS(14).cells(28, 4).value = "=SI(ESERROR(C28*1/C15),0,C28*1/C15)"
        wb.SHEETS(14).cells(31, 4).value = "=SI(ESERROR(C31*1/C15),0,C31*1/C15)"
        wb.SHEETS(14).cells(32, 4).value = "=SI(ESERROR(C32*1/C15),0,C32*1/C15)"
        wb.SHEETS(14).cells(33, 4).value = "=SI(ESERROR(C33*1/C15),0,C33*1/C15)"
        wb.SHEETS(14).cells(34, 4).value = "=SI(ESERROR(C34*1/C15),0,C34*1/C15)"
        wb.SHEETS(14).cells(35, 4).value = "=SI(ESERROR(C35*1/C15),0,C35*1/C15)"
        wb.SHEETS(14).cells(37, 4).value = "=SI(ESERROR(C37*1/C15),0,C37*1/C15)"
        wb.SHEETS(14).cells(39, 4).value = "=SI(ESERROR(C39*1/C15),0,C39*1/C15)"
        wb.SHEETS(14).cells(42, 4).value = "=SI(ESERROR(C42*1/C15),0,C42*1/C15)"
        wb.SHEETS(14).cells(44, 4).value = "=SI(ESERROR(C44*1/C15),0,C44*1/C15)"
        wb.SHEETS(14).cells(47, 4).value = "=SI(ESERROR(C47*1/C15),0,C47*1/C15)"
        wb.SHEETS(14).cells(48, 4).value = "=SI(ESERROR(C48*1/C15),0,C48*1/C15)"
        wb.SHEETS(14).cells(49, 4).value = "=SI(ESERROR(C49*1/C15),0,C49*1/C15)"
        wb.SHEETS(14).cells(50, 4).value = "=SI(ESERROR(C50*1/C15),0,C50*1/C15)"
        wb.SHEETS(14).cells(51, 4).value = "=SI(ESERROR(C51*1/C15),0,C51*1/C15)"
        wb.SHEETS(14).cells(52, 4).value = "=SI(ESERROR(C52*1/C15),0,C52*1/C15)"
        wb.SHEETS(14).cells(53, 4).value = "=SI(ESERROR(C53*1/C15),0,C53*1/C15)"
        wb.SHEETS(14).cells(54, 4).value = "=SI(ESERROR(C54*1/C15),0,C54*1/C15)"
        wb.SHEETS(14).cells(55, 4).value = "=SI(ESERROR(C55*1/C15),0,C55*1/C15)"
        wb.SHEETS(14).cells(60, 4).value = "=SI(ESERROR(C60*1/C15),0,C60*1/C15)"
        wb.SHEETS(14).cells(62, 4).value = "=SI(ESERROR(C62*1/C15),0,C62*1/C15)"
        wb.SHEETS(14).cells(57, 4).value = "=SI(ESERROR(C57*1/C15),0,C57*1/C15)"
        wb.SHEETS(14).cells(59, 4).value = "=SI(ESERROR(C59*1/C15),0,C59*1/C15)"
        wb.SHEETS(14).cells(61, 4).value = "=SI(ESERROR(C61*1/C15),0,C61*1/C15)"
        wb.SHEETS(14).cells(63, 4).value = "=SI(ESERROR(C63*1/C15),0,C63*1/C15)"

        wb.SHEETS(14).cells(9, 5).value = "=SI(ESERROR(C9*1/F5),0,C9*1/F5)"
        wb.SHEETS(14).cells(10, 5).value = "=SI(ESERROR(C10*1/F5),0,C10*1/F5)"
        wb.SHEETS(14).cells(11, 5).value = "=SI(ESERROR(C11*1/F5),0,C11*1/F5)"
        wb.SHEETS(14).cells(12, 5).value = "=SI(ESERROR(C12*1/F5),0,C12*1/F5)"
        wb.SHEETS(14).cells(13, 5).value = "=SI(ESERROR(C13*1/F5),0,C13*1/F5)"
        wb.SHEETS(14).cells(18, 5).value = "=SI(ESERROR(C18*1/F5),0,C18*1/F5)"
        wb.SHEETS(14).cells(19, 5).value = "=SI(ESERROR(C19*1/F5),0,C19*1/F5)"
        wb.SHEETS(14).cells(20, 5).value = "=SI(ESERROR(C20*1/F5),0,C20*1/F5)"
        wb.SHEETS(14).cells(21, 5).value = "=SI(ESERROR(C21*1/F5),0,C21*1/F5)"
        wb.SHEETS(14).cells(22, 5).value = "=SI(ESERROR(C22*1/F5),0,C22*1/F5)"
        wb.SHEETS(14).cells(23, 5).value = "=SI(ESERROR(C23*1/F5),0,C23*1/F5)"
        wb.SHEETS(14).cells(24, 5).value = "=SI(ESERROR(C24*1/F5),0,C24*1/F5)"
        wb.SHEETS(14).cells(31, 5).value = "=SI(ESERROR(C31*1/F5),0,C31*1/F5)"
        wb.SHEETS(14).cells(32, 5).value = "=SI(ESERROR(C32*1/F5),0,C32*1/F5)"
        wb.SHEETS(14).cells(33, 5).value = "=SI(ESERROR(C33*1/F5),0,C33*1/F5)"
        wb.SHEETS(14).cells(34, 5).value = "=SI(ESERROR(C34*1/F5),0,C34*1/F5)"
        wb.SHEETS(14).cells(35, 5).value = "=SI(ESERROR(C35*1/F5),0,C35*1/F5)"
        wb.SHEETS(14).cells(42, 5).value = "=SI(ESERROR(C42*1/F5),0,C42*1/F5)"
        wb.SHEETS(14).cells(47, 5).value = "=SI(ESERROR(C47*1/F5),0,C47*1/F5)"
        wb.SHEETS(14).cells(48, 5).value = "=SI(ESERROR(C48*1/F5),0,C48*1/F5)"
        wb.SHEETS(14).cells(49, 5).value = "=SI(ESERROR(C49*1/F5),0,C49*1/F5)"
        wb.SHEETS(14).cells(50, 5).value = "=SI(ESERROR(C50*1/F5),0,C50*1/F5)"
        wb.SHEETS(14).cells(51, 5).value = "=SI(ESERROR(C51*1/F5),0,C51*1/F5)"
        wb.SHEETS(14).cells(52, 5).value = "=SI(ESERROR(C52*1/F5),0,C52*1/F5)"
        wb.SHEETS(14).cells(53, 5).value = "=SI(ESERROR(C53*1/F5),0,C53*1/F5)"
        wb.SHEETS(14).cells(54, 5).value = "=SI(ESERROR(C54*1/F5),0,C54*1/F5)"
        wb.SHEETS(14).cells(55, 5).value = "=SI(ESERROR(C55*1/F5),0,C55*1/F5)"
        wb.SHEETS(14).cells(60, 5).value = "=SI(ESERROR(C60*1/F5),0,C60*1/F5)"
        wb.SHEETS(14).cells(62, 5).value = "=SI(ESERROR(C62*1/F5),0,C62*1/F5)"
        wb.SHEETS(14).cells(15, 5).value = "=SI(ESERROR(C15*1/F5),0,C15*1/F5)"
        wb.SHEETS(14).cells(26, 5).value = "=SI(ESERROR(C26*1/F5),0,C26*1/F5)"
        wb.SHEETS(14).cells(28, 5).value = "=SI(ESERROR(C28*1/F5),0,C28*1/F5)"
        wb.SHEETS(14).cells(37, 5).value = "=SI(ESERROR(C37*1/F5),0,C37*1/F5)"
        wb.SHEETS(14).cells(39, 5).value = "=SI(ESERROR(C39*1/F5),0,C39*1/F5)"
        wb.SHEETS(14).cells(44, 5).value = "=SI(ESERROR(C44*1/F5),0,C44*1/F5)"
        wb.SHEETS(14).cells(57, 5).value = "=SI(ESERROR(C57*1/F5),0,C57*1/F5)"
        wb.SHEETS(14).cells(59, 5).value = "=SI(ESERROR(C59*1/F5),0,C59*1/F5)"
        wb.SHEETS(14).cells(61, 5).value = "=SI(ESERROR(C61*1/F5),0,C61*1/F5)"
        wb.SHEETS(14).cells(63, 5).value = "=SI(ESERROR(C63*1/F5),0,C63*1/F5)"

        wb.SHEETS(14).cells(9, 6).value = "=SI(ESERROR(C9*1/F4),0,C9*1/F4)"
        wb.SHEETS(14).cells(10, 6).value = "=SI(ESERROR(C10*1/F4),0,C10*1/F4)"
        wb.SHEETS(14).cells(11, 6).value = "=SI(ESERROR(C11*1/F4),0,C11*1/F4)"
        wb.SHEETS(14).cells(12, 6).value = "=SI(ESERROR(C12*1/F4),0,C12*1/F4)"
        wb.SHEETS(14).cells(13, 6).value = "=SI(ESERROR(C13*1/F4),0,C13*1/F4)"
        wb.SHEETS(14).cells(18, 6).value = "=SI(ESERROR(C18*1/F4),0,C18*1/F4)"
        wb.SHEETS(14).cells(19, 6).value = "=SI(ESERROR(C19*1/F4),0,C19*1/F4)"
        wb.SHEETS(14).cells(20, 6).value = "=SI(ESERROR(C20*1/F4),0,C20*1/F4)"
        wb.SHEETS(14).cells(21, 6).value = "=SI(ESERROR(C21*1/F4),0,C21*1/F4)"
        wb.SHEETS(14).cells(22, 6).value = "=SI(ESERROR(C22*1/F4),0,C22*1/F4)"
        wb.SHEETS(14).cells(23, 6).value = "=SI(ESERROR(C23*1/F4),0,C23*1/F4)"
        wb.SHEETS(14).cells(24, 6).value = "=SI(ESERROR(C24*1/F4),0,C24*1/F4)"
        wb.SHEETS(14).cells(31, 6).value = "=SI(ESERROR(C31*1/F4),0,C31*1/F4)"
        wb.SHEETS(14).cells(32, 6).value = "=SI(ESERROR(C32*1/F4),0,C32*1/F4)"
        wb.SHEETS(14).cells(33, 6).value = "=SI(ESERROR(C33*1/F4),0,C33*1/F4)"
        wb.SHEETS(14).cells(34, 6).value = "=SI(ESERROR(C34*1/F4),0,C34*1/F4)"
        wb.SHEETS(14).cells(35, 6).value = "=SI(ESERROR(C35*1/F4),0,C35*1/F4)"
        wb.SHEETS(14).cells(42, 6).value = "=SI(ESERROR(C42*1/F4),0,C42*1/F4)"
        wb.SHEETS(14).cells(47, 6).value = "=SI(ESERROR(C47*1/F4),0,C47*1/F4)"
        wb.SHEETS(14).cells(48, 6).value = "=SI(ESERROR(C48*1/F4),0,C48*1/F4)"
        wb.SHEETS(14).cells(49, 6).value = "=SI(ESERROR(C49*1/F4),0,C49*1/F4)"
        wb.SHEETS(14).cells(50, 6).value = "=SI(ESERROR(C50*1/F4),0,C50*1/F4)"
        wb.SHEETS(14).cells(51, 6).value = "=SI(ESERROR(C51*1/F4),0,C51*1/F4)"
        wb.SHEETS(14).cells(52, 6).value = "=SI(ESERROR(C52*1/F4),0,C52*1/F4)"
        wb.SHEETS(14).cells(53, 6).value = "=SI(ESERROR(C53*1/F4),0,C53*1/F4)"
        wb.SHEETS(14).cells(54, 6).value = "=SI(ESERROR(C54*1/F4),0,C54*1/F4)"
        wb.SHEETS(14).cells(55, 6).value = "=SI(ESERROR(C55*1/F4),0,C55*1/F4)"
        wb.SHEETS(14).cells(60, 6).value = "=SI(ESERROR(C60*1/F4),0,C60*1/F4)"
        wb.SHEETS(14).cells(62, 6).value = "=SI(ESERROR(C62*1/F4),0,C62*1/F4)"
        wb.SHEETS(14).cells(15, 6).value = "=SI(ESERROR(C15*1/F4),0,C15*1/F4)"
        wb.SHEETS(14).cells(26, 6).value = "=SI(ESERROR(C26*1/F4),0,C26*1/F4)"
        wb.SHEETS(14).cells(28, 6).value = "=SI(ESERROR(C28*1/F4),0,C28*1/F4)"
        wb.SHEETS(14).cells(37, 6).value = "=SI(ESERROR(C37*1/F4),0,C37*1/F4)"
        wb.SHEETS(14).cells(39, 6).value = "=SI(ESERROR(C39*1/F4),0,C39*1/F4)"
        wb.SHEETS(14).cells(44, 6).value = "=SI(ESERROR(C44*1/F4),0,C44*1/F4)"
        wb.SHEETS(14).cells(57, 6).value = "=SI(ESERROR(C57*1/F4),0,C57*1/F4)"
        wb.SHEETS(14).cells(59, 6).value = "=SI(ESERROR(C59*1/F4),0,C59*1/F4)"
        wb.SHEETS(14).cells(61, 6).value = "=SI(ESERROR(C61*1/F4),0,C61*1/F4)"
        wb.SHEETS(14).cells(63, 6).value = "=SI(ESERROR(C63*1/F4),0,C63*1/F4)"

        wb.SHEETS(14).cells(65, 2).value = "DATOS ESTADISTICOS"
        wb.SHEETS(14).cells(65, 2).FONT.BOLD = True
        wb.SHEETS(14).cells(66, 2).value = "Kilometros Programados"
        wb.SHEETS(14).cells(67, 2).value = "Kilometros Recorridos"
        wb.SHEETS(14).cells(68, 2).value = "Kms. Prom.. P/Carro"
        wb.SHEETS(14).cells(69, 2).value = "Costo diesel por litro"
        wb.SHEETS(14).cells(70, 2).value = "Total Lts Diesel"
        wb.SHEETS(14).cells(71, 2).value = "Rendimiento Kms/Lts Diesel"
        wb.SHEETS(14).cells(72, 2).value = "Costo diesel/Km"

        wb.SHEETS(14).cells(67, 6).value = "=F4"
        wb.SHEETS(14).cells(68, 6).value = "=F67/F5"
        wb.SHEETS(14).cells(69, 6).value = "=RPA!$J$8"
        wb.SHEETS(14).cells(70, 6).value = "=C18/F69"
        wb.SHEETS(14).cells(71, 6).value = "=F67/F70"
        wb.SHEETS(14).cells(72, 6).value = "=C18/F67"




        wb.SHEETS(14).columns(2).columnwidth = 44
        For i = 3 To 6
            wb.SHEETS(14).columns(i).columnwidth = 12
            wb.SHEETS(14).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(14).columns(4).NumberFormat = "0.00%"

        wb.SHEETS(14).RANGE("B1:F72").Copy()
        wb.SHEETS(14).RANGE("B74").select()
        wb.SHEETS(14).paste()
        wb.SHEETS(14).RANGE("B147").select()
        wb.SHEETS(14).paste()
        wb.SHEETS(14).RANGE("B220").select()
        wb.SHEETS(14).paste()
        wb.SHEETS(14).RANGE("B293").select()
        wb.SHEETS(14).paste()

        wb.SHEETS(14).cells(75, 2).value = "Autobuses Centrales de Guanajuato SA de CV"
        wb.SHEETS(14).cells(148, 2).value = "Servicio de Pasaje Terrestre del Bajio SA de CV"
        wb.SHEETS(14).cells(221, 2).value = "Union de Permisionarios de Autobuses Azules y Triangulos SA"
        wb.SHEETS(14).cells(294, 2).value = "Linea Centro Bellavista SA de CV"
        wb.SHEETS(14).cells(78, 6).value = "=RPA!E3"
        wb.SHEETS(14).cells(151, 6).value = "=RPA!E4"
        wb.SHEETS(14).cells(224, 6).value = "=RPA!E5"
        wb.SHEETS(14).cells(297, 6).value = "=RPA!E6"
        xl.application.cutcopymode = False

        wb.SHEETS(14).name = "EDO Resultados Kms Empresa"

    End Sub
    Sub ResultadosKmsAUSLAPI()
        Dim rng As Integer = 2

        wb.SHEETS(14).select()
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        wb.SHEETS(15).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(15).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(15).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(15).cells(rng, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(15).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(15).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(15).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(15).cells(rng, 2).value = "Estado de Resultados por Kilometros AUSL API"
        rng = rng + 2

        wb.SHEETS(15).cells(4, 5).value = "Kilometros"
        wb.SHEETS(15).cells(5, 5).value = "Autobuses"

        For I = 4 To 5
            For j = 5 To 6
                wb.SHEETS(15).cells(I, j).font.bold = True
                wb.SHEETS(15).CELLS(I, j).HorizontalAlignment = -4108
                wb.SHEETS(15).CELLS(I, j).VerticalAlignment = -4108
                wb.SHEETS(15).CELLS(I, j).WrapText = True
                wb.SHEETS(15).CELLS(I, j).Orientation = 0
                wb.SHEETS(15).CELLS(I, j).AddIndent = False
                wb.SHEETS(15).CELLS(I, j).IndentLevel = 0
                wb.SHEETS(15).CELLS(I, j).ShrinkToFit = False
                wb.SHEETS(15).CELLS(I, j).MergeCells = False
                wb.SHEETS(15).CELLS(I, j).ReadingOrder = -5002
            Next
        Next

        wb.SHEETS(15).Range("E4:F5").INTERIOR.ThemeColor = 1
        wb.SHEETS(15).Range("E4:F5").INTERIOR.TintAndShade = -0.0499893185216834


        'AGREGA DEFINICIONES
        wb.SHEETS(15).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(15).cells(rng, 3).value = "TOTAL"
        wb.SHEETS(15).cells(rng, 4).value = "%ING"
        wb.SHEETS(15).cells(rng, 5).value = "POR AUTOBUS"
        wb.SHEETS(15).cells(rng, 6).value = "POR KMS RECORRIDO"


        For I = 2 To 6
            wb.SHEETS(15).cells(rng, I).font.bold = True
            wb.SHEETS(15).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(15).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(15).CELLS(rng, I).WrapText = True
            wb.SHEETS(15).CELLS(rng, I).Orientation = 0
            wb.SHEETS(15).CELLS(rng, I).AddIndent = False
            wb.SHEETS(15).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(15).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(15).CELLS(rng, I).MergeCells = False
            wb.SHEETS(15).CELLS(rng, I).ReadingOrder = -5002
        Next



        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(15).cells(9, 2).value = "Ingresos Boletos de Abordo"
        wb.SHEETS(15).cells(10, 2).value = "Ingresos Pagobus"
        wb.SHEETS(15).cells(11, 2).value = "Ingresos Red Integral Optibus"
        wb.SHEETS(15).cells(12, 2).value = "Otros Ingresos"
        wb.SHEETS(15).cells(13, 2).value = "Servicios Especiales"
        wb.SHEETS(15).cells(15, 2).value = "Total de Ingresos"


        wb.SHEETS(15).Range("C15:F15").INTERIOR.ThemeColor = 1
        wb.SHEETS(15).Range("C15:F15").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(15).Range("C26:F26").INTERIOR.ThemeColor = 1
        wb.SHEETS(15).Range("C26:F26").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(15).Range("C37:F37").INTERIOR.ThemeColor = 1
        wb.SHEETS(15).Range("C37:F37").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(15).Range("C57:F57").INTERIOR.ThemeColor = 1
        wb.SHEETS(15).Range("C57:F57").INTERIOR.TintAndShade = -0.0499893185216834

        wb.SHEETS(15).Range("C28:F28").INTERIOR.ThemeColor = 1
        wb.SHEETS(15).Range("C28:F28").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(15).Range("C39:F39").INTERIOR.ThemeColor = 1
        wb.SHEETS(15).Range("C39:F39").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(15).Range("C44:F44").INTERIOR.ThemeColor = 1
        wb.SHEETS(15).Range("C44:F44").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(15).Range("C59:FO59").INTERIOR.ThemeColor = 1
        wb.SHEETS(15).Range("C59:F59").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(15).Range("C61:F61").INTERIOR.ThemeColor = 1
        wb.SHEETS(15).Range("C61:F61").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(15).Range("C63:F63").INTERIOR.ThemeColor = 1
        wb.SHEETS(15).Range("C63:F63").INTERIOR.TintAndShade = -0.149998474074526

        wb.SHEETS(15).cells(17, 2).value = "COSTOS DIRECTOS"
        wb.SHEETS(15).cells(18, 2).value = "Diesel"
        wb.SHEETS(15).cells(19, 2).value = "Sueldos y Salarios"
        wb.SHEETS(15).cells(20, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(15).cells(21, 2).value = "Refacciones"
        wb.SHEETS(15).cells(22, 2).value = "Mantenimiento y Reparación de Autobuses"
        wb.SHEETS(15).cells(23, 2).value = "Llantas Nuevas"
        wb.SHEETS(15).cells(24, 2).value = "Llantas Vitalizadas"
        wb.SHEETS(15).cells(26, 2).value = "Total de Costos Directos"

        wb.SHEETS(15).cells(28, 2).value = "UTILIDAD BRUTA"

        wb.SHEETS(15).cells(30, 2).value = "COSTOS INDIRECTOS DE OPERACIÓN"
        wb.SHEETS(15).cells(31, 2).value = "Gastos de Mantenimiento"
        wb.SHEETS(15).cells(32, 2).value = "Gastos de Operación y Servicios"
        wb.SHEETS(15).cells(33, 2).value = "Gastos de Seguro Interno"
        wb.SHEETS(15).cells(34, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(15).cells(35, 2).value = "Gastos Diversos de Operación"
        wb.SHEETS(15).cells(37, 2).value = "Total de Costos Indirectos"

        wb.SHEETS(15).cells(39, 2).value = "UTILIDAD MARGINAL"

        wb.SHEETS(15).cells(41, 2).value = "COSTOS INDIRECTOS DE ADMINISTRACIÓN"
        wb.SHEETS(15).cells(42, 2).value = "Gastos de Administración"

        wb.SHEETS(15).cells(44, 2).value = "UTILIDAD ANTES DE RESERVAS"

        wb.SHEETS(15).cells(46, 2).value = "RESERVAS"
        wb.SHEETS(15).cells(47, 2).value = "Reserva para Aguinaldo"
        wb.SHEETS(15).cells(48, 2).value = "Reserva para Tenencias y Refrendos"
        wb.SHEETS(15).cells(49, 2).value = "Reserva para Prima de Seguros"
        wb.SHEETS(15).cells(50, 2).value = "Fondo para Renovación de Equipo"
        wb.SHEETS(15).cells(51, 2).value = "Aportaciones al Fideicomiso"
        wb.SHEETS(15).cells(52, 2).value = "Reserva para Capacitación Adiestramiento Seguridad e Higiene y Otros"
        wb.SHEETS(15).cells(53, 2).value = "Reserva  PTU"
        wb.SHEETS(15).cells(54, 2).value = "Reserva para Uniformes y Otros Gastos Mayores"
        wb.SHEETS(15).cells(55, 2).value = "Reserva para Adquisición de Activos"

        wb.SHEETS(15).cells(57, 2).value = "Total de Reservas"

        wb.SHEETS(15).cells(59, 2).value = "RESULTADO ANTES DE DOCUMENTOS"
        wb.SHEETS(15).cells(60, 2).value = "Documento de Unidades"
        wb.SHEETS(15).cells(61, 2).value = "RESULTADO ANTES IMPUESTOS"
        wb.SHEETS(15).cells(62, 2).value = "Impuesto Sobre la Renta"
        wb.SHEETS(15).cells(63, 2).value = "RESULTADO NETO"

        wb.SHEETS(15).cells(15, 3).value = "=SUMA(C9:C14)"
        wb.SHEETS(15).cells(26, 3).value = "=SUMA(C18:C25)"
        wb.SHEETS(15).cells(28, 3).value = "=C15-C26"
        wb.SHEETS(15).cells(37, 3).value = "=SUMA(C31:C36)"
        wb.SHEETS(15).cells(39, 3).value = "=C28-C37"
        wb.SHEETS(15).cells(44, 3).value = "=C39-C42"
        wb.SHEETS(15).cells(57, 3).value = "=SUMA(C47:C56)"
        wb.SHEETS(15).cells(59, 3).value = "=C44-C57"
        wb.SHEETS(15).cells(61, 3).value = "=C59-C60"
        wb.SHEETS(15).cells(63, 3).value = "=C61-C62"

        wb.SHEETS(15).cells(4, 6).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,3,FALSO)"
        wb.SHEETS(15).cells(5, 6).value = "=RPA!E7"

        wb.SHEETS(15).cells(9, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$L$10:$L$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$L$10:$L$1000))"
        wb.SHEETS(15).cells(10, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$N$10:$N$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$N$10:$N$1000))"
        wb.SHEETS(15).cells(11, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$O$10:$O$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$O$10:$O$1000))"
        wb.SHEETS(15).cells(12, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$Q$10:$Q$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$Q$10:$Q$1000))"
        wb.SHEETS(15).cells(13, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$R$10:$R$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$R$10:$R$1000))"
        wb.SHEETS(15).cells(18, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$V$10:$V$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$V$10:$V$1000))"
        wb.SHEETS(15).cells(19, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$W$10:$W$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$W$10:$W$1000))"
        wb.SHEETS(15).cells(20, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$X$10:$X$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$X$10:$X$1000))"
        wb.SHEETS(15).cells(21, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$Z$10:$Z$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$Z$10:$Z$1000))"
        wb.SHEETS(15).cells(22, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AB$10:$AB$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AB$10:$AB$1000))"
        wb.SHEETS(15).cells(23, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AD$10:$AD$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AD$10:$AD$1000))"
        wb.SHEETS(15).cells(24, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AF$10:$AF$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AF$10:$AF$1000))"
        wb.SHEETS(15).cells(31, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AK$10:$AK$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AK$10:$AK$1000))"
        wb.SHEETS(15).cells(32, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AL$10:$AL$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AL$10:$AL$1000))"
        wb.SHEETS(15).cells(33, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AM$10:$AM$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AM$10:$AM$1000))"
        wb.SHEETS(15).cells(34, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AN$10:$AN$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AN$10:$AN$1000))"
        wb.SHEETS(15).cells(35, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AO$10:$AO$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AO$10:$AO$1000))"
        wb.SHEETS(15).cells(42, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AT$10:$AT$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AT$10:$AT$1000))"
        wb.SHEETS(15).cells(47, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AX$10:$AX$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AX$10:$AX$1000))"
        wb.SHEETS(15).cells(48, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AY$10:$AY$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AY$10:$AY$1000))"
        wb.SHEETS(15).cells(49, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$AZ$10:$AZ$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$AZ$10:$AZ$1000))"
        wb.SHEETS(15).cells(50, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BA$10:$BA$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BA$10:$BA$1000))"
        wb.SHEETS(15).cells(51, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BB$10:$BB$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BB$10:$BB$1000))"
        wb.SHEETS(15).cells(52, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BC$10:$BC$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BC$10:$BC$1000))"
        wb.SHEETS(15).cells(53, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BD$10:$BD$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BD$10:$BD$1000))"
        wb.SHEETS(15).cells(54, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BE$10:$BE$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BE$10:$BE$1000))"
        wb.SHEETS(15).cells(55, 3).value = "=(((SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",RPA!$BF$10:$BF$1000))/107)*88)+(SUMAR.SI(RPA!$F$10:$BO$1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",RPA!$BF$10:$BF$1000))"


        wb.SHEETS(15).cells(9, 4).value = "=SI(ESERROR(C9*1/$C$15),0,C9*1/$C$15)"
        wb.SHEETS(15).cells(10, 4).value = "=SI(ESERROR(C10*1/$C$15),0,C10*1/$C$15)"
        wb.SHEETS(15).cells(11, 4).value = "=SI(ESERROR(C11*1/$C$15),0,C11*1/$C$15)"
        wb.SHEETS(15).cells(12, 4).value = "=SI(ESERROR(C12*1/$C$15),0,C12*1/$C$15)"
        wb.SHEETS(15).cells(13, 4).value = "=SI(ESERROR(C13*1/$C$15),0,C13*1/$C$15)"
        wb.SHEETS(15).cells(15, 4).value = "=SI(ESERROR(C15*1/$C$15),0,C15*1/$C$15)"
        wb.SHEETS(15).cells(18, 4).value = "=SI(ESERROR(C18*1/$C$15),0,C18*1/$C$15)"
        wb.SHEETS(15).cells(19, 4).value = "=SI(ESERROR(C19*1/$C$15),0,C19*1/$C$15)"
        wb.SHEETS(15).cells(20, 4).value = "=SI(ESERROR(C20*1/$C$15),0,C20*1/$C$15)"
        wb.SHEETS(15).cells(21, 4).value = "=SI(ESERROR(C21*1/$C$15),0,C21*1/$C$15)"
        wb.SHEETS(15).cells(22, 4).value = "=SI(ESERROR(C22*1/$C$15),0,C22*1/$C$15)"
        wb.SHEETS(15).cells(23, 4).value = "=SI(ESERROR(C23*1/$C$15),0,C23*1/$C$15)"
        wb.SHEETS(15).cells(24, 4).value = "=SI(ESERROR(C24*1/$C$15),0,C24*1/$C$15)"
        wb.SHEETS(15).cells(26, 4).value = "=SI(ESERROR(C26*1/$C$15),0,C26*1/$C$15)"
        wb.SHEETS(15).cells(28, 4).value = "=SI(ESERROR(C28*1/$C$15),0,C28*1/$C$15)"
        wb.SHEETS(15).cells(31, 4).value = "=SI(ESERROR(C31*1/$C$15),0,C31*1/$C$15)"
        wb.SHEETS(15).cells(32, 4).value = "=SI(ESERROR(C32*1/$C$15),0,C32*1/$C$15)"
        wb.SHEETS(15).cells(33, 4).value = "=SI(ESERROR(C33*1/$C$15),0,C33*1/$C$15)"
        wb.SHEETS(15).cells(34, 4).value = "=SI(ESERROR(C34*1/$C$15),0,C34*1/$C$15)"
        wb.SHEETS(15).cells(35, 4).value = "=SI(ESERROR(C35*1/$C$15),0,C35*1/$C$15)"
        wb.SHEETS(15).cells(37, 4).value = "=SI(ESERROR(C37*1/$C$15),0,C37*1/$C$15)"
        wb.SHEETS(15).cells(39, 4).value = "=SI(ESERROR(C39*1/$C$15),0,C39*1/$C$15)"
        wb.SHEETS(15).cells(42, 4).value = "=SI(ESERROR(C42*1/$C$15),0,C42*1/$C$15)"
        wb.SHEETS(15).cells(44, 4).value = "=SI(ESERROR(C44*1/$C$15),0,C44*1/$C$15)"
        wb.SHEETS(15).cells(47, 4).value = "=SI(ESERROR(C47*1/$C$15),0,C47*1/$C$15)"
        wb.SHEETS(15).cells(48, 4).value = "=SI(ESERROR(C48*1/$C$15),0,C48*1/$C$15)"
        wb.SHEETS(15).cells(49, 4).value = "=SI(ESERROR(C49*1/$C$15),0,C49*1/$C$15)"
        wb.SHEETS(15).cells(50, 4).value = "=SI(ESERROR(C50*1/$C$15),0,C50*1/$C$15)"
        wb.SHEETS(15).cells(51, 4).value = "=SI(ESERROR(C51*1/$C$15),0,C51*1/$C$15)"
        wb.SHEETS(15).cells(52, 4).value = "=SI(ESERROR(C52*1/$C$15),0,C52*1/$C$15)"
        wb.SHEETS(15).cells(53, 4).value = "=SI(ESERROR(C53*1/$C$15),0,C53*1/$C$15)"
        wb.SHEETS(15).cells(54, 4).value = "=SI(ESERROR(C54*1/$C$15),0,C54*1/$C$15)"
        wb.SHEETS(15).cells(55, 4).value = "=SI(ESERROR(C55*1/$C$15),0,C55*1/$C$15)"
        wb.SHEETS(15).cells(60, 4).value = "=SI(ESERROR(C60*1/$C$15),0,C60*1/$C$15)"
        wb.SHEETS(15).cells(62, 4).value = "=SI(ESERROR(C62*1/$C$15),0,C62*1/$C$15)"
        wb.SHEETS(15).cells(57, 4).value = "=SI(ESERROR(C57*1/$C$15),0,C57*1/$C$15)"
        wb.SHEETS(15).cells(59, 4).value = "=SI(ESERROR(C59*1/$C$15),0,C59*1/$C$15)"
        wb.SHEETS(15).cells(61, 4).value = "=SI(ESERROR(C61*1/$C$15),0,C61*1/$C$15)"
        wb.SHEETS(15).cells(63, 4).value = "=SI(ESERROR(C63*1/$C$15),0,C63*1/$C$15)"

        wb.SHEETS(15).cells(9, 5).value = "=SI(ESERROR(C9*1/$F$5),0,C9*1/$F$5)"
        wb.SHEETS(15).cells(10, 5).value = "=SI(ESERROR(C10*1/$F$5),0,C10*1/$F$5)"
        wb.SHEETS(15).cells(11, 5).value = "=SI(ESERROR(C11*1/$F$5),0,C11*1/$F$5)"
        wb.SHEETS(15).cells(12, 5).value = "=SI(ESERROR(C12*1/$F$5),0,C12*1/$F$5)"
        wb.SHEETS(15).cells(13, 5).value = "=SI(ESERROR(C13*1/$F$5),0,C13*1/$F$5)"
        wb.SHEETS(15).cells(18, 5).value = "=SI(ESERROR(C18*1/$F$5),0,C18*1/$F$5)"
        wb.SHEETS(15).cells(19, 5).value = "=SI(ESERROR(C19*1/$F$5),0,C19*1/$F$5)"
        wb.SHEETS(15).cells(20, 5).value = "=SI(ESERROR(C20*1/$F$5),0,C20*1/$F$5)"
        wb.SHEETS(15).cells(21, 5).value = "=SI(ESERROR(C21*1/$F$5),0,C21*1/$F$5)"
        wb.SHEETS(15).cells(22, 5).value = "=SI(ESERROR(C22*1/$F$5),0,C22*1/$F$5)"
        wb.SHEETS(15).cells(23, 5).value = "=SI(ESERROR(C23*1/$F$5),0,C23*1/$F$5)"
        wb.SHEETS(15).cells(24, 5).value = "=SI(ESERROR(C24*1/$F$5),0,C24*1/$F$5)"
        wb.SHEETS(15).cells(31, 5).value = "=SI(ESERROR(C31*1/$F$5),0,C31*1/$F$5)"
        wb.SHEETS(15).cells(32, 5).value = "=SI(ESERROR(C32*1/$F$5),0,C32*1/$F$5)"
        wb.SHEETS(15).cells(33, 5).value = "=SI(ESERROR(C33*1/$F$5),0,C33*1/$F$5)"
        wb.SHEETS(15).cells(34, 5).value = "=SI(ESERROR(C34*1/$F$5),0,C34*1/$F$5)"
        wb.SHEETS(15).cells(35, 5).value = "=SI(ESERROR(C35*1/$F$5),0,C35*1/$F$5)"
        wb.SHEETS(15).cells(42, 5).value = "=SI(ESERROR(C42*1/$F$5),0,C42*1/$F$5)"
        wb.SHEETS(15).cells(47, 5).value = "=SI(ESERROR(C47*1/$F$5),0,C47*1/$F$5)"
        wb.SHEETS(15).cells(48, 5).value = "=SI(ESERROR(C48*1/$F$5),0,C48*1/$F$5)"
        wb.SHEETS(15).cells(49, 5).value = "=SI(ESERROR(C49*1/$F$5),0,C49*1/$F$5)"
        wb.SHEETS(15).cells(50, 5).value = "=SI(ESERROR(C50*1/$F$5),0,C50*1/$F$5)"
        wb.SHEETS(15).cells(51, 5).value = "=SI(ESERROR(C51*1/$F$5),0,C51*1/$F$5)"
        wb.SHEETS(15).cells(52, 5).value = "=SI(ESERROR(C52*1/$F$5),0,C52*1/$F$5)"
        wb.SHEETS(15).cells(53, 5).value = "=SI(ESERROR(C53*1/$F$5),0,C53*1/$F$5)"
        wb.SHEETS(15).cells(54, 5).value = "=SI(ESERROR(C54*1/$F$5),0,C54*1/$F$5)"
        wb.SHEETS(15).cells(55, 5).value = "=SI(ESERROR(C55*1/$F$5),0,C55*1/$F$5)"
        wb.SHEETS(15).cells(60, 5).value = "=SI(ESERROR(C60*1/$F$5),0,C60*1/$F$5)"
        wb.SHEETS(15).cells(62, 5).value = "=SI(ESERROR(C62*1/$F$5),0,C62*1/$F$5)"
        wb.SHEETS(15).cells(15, 5).value = "=SI(ESERROR(C15*1/$F$5),0,C15*1/$F$5)"
        wb.SHEETS(15).cells(26, 5).value = "=SI(ESERROR(C26*1/$F$5),0,C26*1/$F$5)"
        wb.SHEETS(15).cells(28, 5).value = "=SI(ESERROR(C28*1/$F$5),0,C28*1/$F$5)"
        wb.SHEETS(15).cells(37, 5).value = "=SI(ESERROR(C37*1/$F$5),0,C37*1/$F$5)"
        wb.SHEETS(15).cells(39, 5).value = "=SI(ESERROR(C39*1/$F$5),0,C39*1/$F$5)"
        wb.SHEETS(15).cells(44, 5).value = "=SI(ESERROR(C44*1/$F$5),0,C44*1/$F$5)"
        wb.SHEETS(15).cells(57, 5).value = "=SI(ESERROR(C57*1/$F$5),0,C57*1/$F$5)"
        wb.SHEETS(15).cells(59, 5).value = "=SI(ESERROR(C59*1/$F$5),0,C59*1/$F$5)"
        wb.SHEETS(15).cells(61, 5).value = "=SI(ESERROR(C61*1/$F$5),0,C61*1/$F$5)"
        wb.SHEETS(15).cells(63, 5).value = "=SI(ESERROR(C63*1/$F$5),0,C63*1/$F$5)"

        wb.SHEETS(15).cells(9, 6).value = "=SI(ESERROR(C9*1/$F$4),0,C9*1/$F$4)"
        wb.SHEETS(15).cells(10, 6).value = "=SI(ESERROR(C10*1/$F$4),0,C10*1/$F$4)"
        wb.SHEETS(15).cells(11, 6).value = "=SI(ESERROR(C11*1/$F$4),0,C11*1/$F$4)"
        wb.SHEETS(15).cells(12, 6).value = "=SI(ESERROR(C12*1/$F$4),0,C12*1/$F$4)"
        wb.SHEETS(15).cells(13, 6).value = "=SI(ESERROR(C13*1/$F$4),0,C13*1/$F$4)"
        wb.SHEETS(15).cells(18, 6).value = "=SI(ESERROR(C18*1/$F$4),0,C18*1/$F$4)"
        wb.SHEETS(15).cells(19, 6).value = "=SI(ESERROR(C19*1/$F$4),0,C19*1/$F$4)"
        wb.SHEETS(15).cells(20, 6).value = "=SI(ESERROR(C20*1/$F$4),0,C20*1/$F$4)"
        wb.SHEETS(15).cells(21, 6).value = "=SI(ESERROR(C21*1/$F$4),0,C21*1/$F$4)"
        wb.SHEETS(15).cells(22, 6).value = "=SI(ESERROR(C22*1/$F$4),0,C22*1/$F$4)"
        wb.SHEETS(15).cells(23, 6).value = "=SI(ESERROR(C23*1/$F$4),0,C23*1/$F$4)"
        wb.SHEETS(15).cells(24, 6).value = "=SI(ESERROR(C24*1/$F$4),0,C24*1/$F$4)"
        wb.SHEETS(15).cells(31, 6).value = "=SI(ESERROR(C31*1/$F$4),0,C31*1/$F$4)"
        wb.SHEETS(15).cells(32, 6).value = "=SI(ESERROR(C32*1/$F$4),0,C32*1/$F$4)"
        wb.SHEETS(15).cells(33, 6).value = "=SI(ESERROR(C33*1/$F$4),0,C33*1/$F$4)"
        wb.SHEETS(15).cells(34, 6).value = "=SI(ESERROR(C34*1/$F$4),0,C34*1/$F$4)"
        wb.SHEETS(15).cells(35, 6).value = "=SI(ESERROR(C35*1/$F$4),0,C35*1/$F$4)"
        wb.SHEETS(15).cells(42, 6).value = "=SI(ESERROR(C42*1/$F$4),0,C42*1/$F$4)"
        wb.SHEETS(15).cells(47, 6).value = "=SI(ESERROR(C47*1/$F$4),0,C47*1/$F$4)"
        wb.SHEETS(15).cells(48, 6).value = "=SI(ESERROR(C48*1/$F$4),0,C48*1/$F$4)"
        wb.SHEETS(15).cells(49, 6).value = "=SI(ESERROR(C49*1/$F$4),0,C49*1/$F$4)"
        wb.SHEETS(15).cells(50, 6).value = "=SI(ESERROR(C50*1/$F$4),0,C50*1/$F$4)"
        wb.SHEETS(15).cells(51, 6).value = "=SI(ESERROR(C51*1/$F$4),0,C51*1/$F$4)"
        wb.SHEETS(15).cells(52, 6).value = "=SI(ESERROR(C52*1/$F$4),0,C52*1/$F$4)"
        wb.SHEETS(15).cells(53, 6).value = "=SI(ESERROR(C53*1/$F$4),0,C53*1/$F$4)"
        wb.SHEETS(15).cells(54, 6).value = "=SI(ESERROR(C54*1/$F$4),0,C54*1/$F$4)"
        wb.SHEETS(15).cells(55, 6).value = "=SI(ESERROR(C55*1/$F$4),0,C55*1/$F$4)"
        wb.SHEETS(15).cells(60, 6).value = "=SI(ESERROR(C60*1/$F$4),0,C60*1/$F$4)"
        wb.SHEETS(15).cells(62, 6).value = "=SI(ESERROR(C62*1/$F$4),0,C62*1/$F$4)"
        wb.SHEETS(15).cells(15, 6).value = "=SI(ESERROR(C15*1/$F$4),0,C15*1/$F$4)"
        wb.SHEETS(15).cells(26, 6).value = "=SI(ESERROR(C26*1/$F$4),0,C26*1/$F$4)"
        wb.SHEETS(15).cells(28, 6).value = "=SI(ESERROR(C28*1/$F$4),0,C28*1/$F$4)"
        wb.SHEETS(15).cells(37, 6).value = "=SI(ESERROR(C37*1/$F$4),0,C37*1/$F$4)"
        wb.SHEETS(15).cells(39, 6).value = "=SI(ESERROR(C39*1/$F$4),0,C39*1/$F$4)"
        wb.SHEETS(15).cells(44, 6).value = "=SI(ESERROR(C44*1/$F$4),0,C44*1/$F$4)"
        wb.SHEETS(15).cells(57, 6).value = "=SI(ESERROR(C57*1/$F$4),0,C57*1/$F$4)"
        wb.SHEETS(15).cells(59, 6).value = "=SI(ESERROR(C59*1/$F$4),0,C59*1/$F$4)"
        wb.SHEETS(15).cells(61, 6).value = "=SI(ESERROR(C61*1/$F$4),0,C61*1/$F$4)"
        wb.SHEETS(15).cells(63, 6).value = "=SI(ESERROR(C63*1/$F$4),0,C63*1/$F$4)"

        wb.SHEETS(15).cells(65, 2).value = "DATOS ESTADISTICOS"
        wb.SHEETS(15).cells(65, 2).FONT.BOLD = True
        wb.SHEETS(15).cells(66, 2).value = "Kilometros Programados"
        wb.SHEETS(15).cells(67, 2).value = "Kilometros Recorridos"
        wb.SHEETS(15).cells(68, 2).value = "Kms. Prom.. P/Carro"
        wb.SHEETS(15).cells(69, 2).value = "Costo diesel por litro"
        wb.SHEETS(15).cells(70, 2).value = "Total Lts Diesel"
        wb.SHEETS(15).cells(71, 2).value = "Rendimiento Kms/Lts Diesel"
        wb.SHEETS(15).cells(72, 2).value = "Costo diesel/Km"

        wb.SHEETS(15).cells(67, 6).value = "=F4"
        wb.SHEETS(15).cells(68, 6).value = "=F67/F5"
        wb.SHEETS(15).cells(69, 6).value = "=RPA!$J$8"
        wb.SHEETS(15).cells(70, 6).value = "=C18/F69"
        wb.SHEETS(15).cells(71, 6).value = "=F67/F70"
        wb.SHEETS(15).cells(72, 6).value = "=C18/F67"



        wb.SHEETS(15).columns(2).columnwidth = 44
        For i = 3 To 6
            wb.SHEETS(15).columns(i).columnwidth = 12
            wb.SHEETS(15).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(15).columns(4).NumberFormat = "0.00%"

        wb.SHEETS(15).name = "EDO Resultados Kms AUSL API"
    End Sub
    Sub ResultadosKmsCoord()
        Dim rng As Integer = 2
       
        wb.SHEETS(12).select()
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        wb.SHEETS(13).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(13).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(13).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(13).cells(rng, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(13).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(13).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(13).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(13).cells(rng, 2).value = "Estado de Resultados por Kilometros Coordinado"
        rng = rng + 2

        wb.SHEETS(13).cells(4, 5).value = "Kilometros"
        wb.SHEETS(13).cells(5, 5).value = "Autobuses"

        For I = 4 To 5
            For j = 5 To 6
                wb.SHEETS(13).cells(I, j).font.bold = True
                wb.SHEETS(13).CELLS(I, j).HorizontalAlignment = -4108
                wb.SHEETS(13).CELLS(I, j).VerticalAlignment = -4108
                wb.SHEETS(13).CELLS(I, j).WrapText = True
                wb.SHEETS(13).CELLS(I, j).Orientation = 0
                wb.SHEETS(13).CELLS(I, j).AddIndent = False
                wb.SHEETS(13).CELLS(I, j).IndentLevel = 0
                wb.SHEETS(13).CELLS(I, j).ShrinkToFit = False
                wb.SHEETS(13).CELLS(I, j).MergeCells = False
                wb.SHEETS(13).CELLS(I, j).ReadingOrder = -5002
            Next
        Next

        wb.SHEETS(13).Range("E4:F5").INTERIOR.ThemeColor = 1
        wb.SHEETS(13).Range("E4:F5").INTERIOR.TintAndShade = -0.0499893185216834


        'AGREGA DEFINICIONES
        wb.SHEETS(13).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(13).cells(rng, 3).value = "TOTAL"
        wb.SHEETS(13).cells(rng, 4).value = "%ING"
        wb.SHEETS(13).cells(rng, 5).value = "POR AUTOBUS"
        wb.SHEETS(13).cells(rng, 6).value = "POR KMS RECORRIDO"


        For I = 2 To 6
            wb.SHEETS(13).cells(rng, I).font.bold = True
            wb.SHEETS(13).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(13).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(13).CELLS(rng, I).WrapText = True
            wb.SHEETS(13).CELLS(rng, I).Orientation = 0
            wb.SHEETS(13).CELLS(rng, I).AddIndent = False
            wb.SHEETS(13).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(13).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(13).CELLS(rng, I).MergeCells = False
            wb.SHEETS(13).CELLS(rng, I).ReadingOrder = -5002
        Next

       

        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(13).cells(9, 2).value = "Ingresos Boletos de Abordo"
        wb.SHEETS(13).cells(10, 2).value = "Ingresos Pagobus"
        wb.SHEETS(13).cells(11, 2).value = "Ingresos Red Integral Optibus"
        wb.SHEETS(13).cells(12, 2).value = "Otros Ingresos"
        wb.SHEETS(13).cells(13, 2).value = "Servicios Especiales"
        wb.SHEETS(13).cells(15, 2).value = "Total de Ingresos"


        wb.SHEETS(13).Range("C15:F15").INTERIOR.ThemeColor = 1
        wb.SHEETS(13).Range("C15:F15").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(13).Range("C26:F26").INTERIOR.ThemeColor = 1
        wb.SHEETS(13).Range("C26:F26").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(13).Range("C37:F37").INTERIOR.ThemeColor = 1
        wb.SHEETS(13).Range("C37:F37").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(13).Range("C57:F57").INTERIOR.ThemeColor = 1
        wb.SHEETS(13).Range("C57:F57").INTERIOR.TintAndShade = -0.0499893185216834

        wb.SHEETS(13).Range("C28:F28").INTERIOR.ThemeColor = 1
        wb.SHEETS(13).Range("C28:F28").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(13).Range("C39:F39").INTERIOR.ThemeColor = 1
        wb.SHEETS(13).Range("C39:F39").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(13).Range("C44:F44").INTERIOR.ThemeColor = 1
        wb.SHEETS(13).Range("C44:F44").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(13).Range("C59:FO59").INTERIOR.ThemeColor = 1
        wb.SHEETS(13).Range("C59:F59").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(13).Range("C61:F61").INTERIOR.ThemeColor = 1
        wb.SHEETS(13).Range("C61:F61").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(13).Range("C63:F63").INTERIOR.ThemeColor = 1
        wb.SHEETS(13).Range("C63:F63").INTERIOR.TintAndShade = -0.149998474074526

        wb.SHEETS(13).cells(17, 2).value = "COSTOS DIRECTOS"
        wb.SHEETS(13).cells(18, 2).value = "Diesel"
        wb.SHEETS(13).cells(19, 2).value = "Sueldos y Salarios"
        wb.SHEETS(13).cells(20, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(13).cells(21, 2).value = "Refacciones"
        wb.SHEETS(13).cells(22, 2).value = "Mantenimiento y Reparación de Autobuses"
        wb.SHEETS(13).cells(23, 2).value = "Llantas Nuevas"
        wb.SHEETS(13).cells(24, 2).value = "Llantas Vitalizadas"
        wb.SHEETS(13).cells(26, 2).value = "Total de Costos Directos"

        wb.SHEETS(13).cells(28, 2).value = "UTILIDAD BRUTA"

        wb.SHEETS(13).cells(30, 2).value = "COSTOS INDIRECTOS DE OPERACIÓN"
        wb.SHEETS(13).cells(31, 2).value = "Gastos de Mantenimiento"
        wb.SHEETS(13).cells(32, 2).value = "Gastos de Operación y Servicios"
        wb.SHEETS(13).cells(33, 2).value = "Gastos de Seguro Interno"
        wb.SHEETS(13).cells(34, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(13).cells(35, 2).value = "Gastos Diversos de Operación"
        wb.SHEETS(13).cells(37, 2).value = "Total de Costos Indirectos"

        wb.SHEETS(13).cells(39, 2).value = "UTILIDAD MARGINAL"

        wb.SHEETS(13).cells(41, 2).value = "COSTOS INDIRECTOS DE ADMINISTRACIÓN"
        wb.SHEETS(13).cells(42, 2).value = "Gastos de Administración"

        wb.SHEETS(13).cells(44, 2).value = "UTILIDAD ANTES DE RESERVAS"

        wb.SHEETS(13).cells(46, 2).value = "RESERVAS"
        wb.SHEETS(13).cells(47, 2).value = "Reserva para Aguinaldo"
        wb.SHEETS(13).cells(48, 2).value = "Reserva para Tenencias y Refrendos"
        wb.SHEETS(13).cells(49, 2).value = "Reserva para Prima de Seguros"
        wb.SHEETS(13).cells(50, 2).value = "Fondo para Renovación de Equipo"
        wb.SHEETS(13).cells(51, 2).value = "Aportaciones al Fideicomiso"
        wb.SHEETS(13).cells(52, 2).value = "Reserva para Capacitación Adiestramiento Seguridad e Higiene y Otros"
        wb.SHEETS(13).cells(53, 2).value = "Reserva  PTU"
        wb.SHEETS(13).cells(54, 2).value = "Reserva para Uniformes y Otros Gastos Mayores"
        wb.SHEETS(13).cells(55, 2).value = "Reserva para Adquisición de Activos"

        wb.SHEETS(13).cells(57, 2).value = "Total de Reservas"

        wb.SHEETS(13).cells(59, 2).value = "RESULTADO ANTES DE DOCUMENTOS"
        wb.SHEETS(13).cells(60, 2).value = "Documento de Unidades"
        wb.SHEETS(13).cells(61, 2).value = "RESULTADO ANTES IMPUESTOS"
        wb.SHEETS(13).cells(62, 2).value = "Impuesto Sobre la Renta"
        wb.SHEETS(13).cells(63, 2).value = "RESULTADO NETO"

        wb.SHEETS(13).cells(15, 3).value = "=SUMA(C9:C14)"
        wb.SHEETS(13).cells(26, 3).value = "=SUMA(C18:C25)"
        wb.SHEETS(13).cells(28, 3).value = "=C15-C26"
        wb.SHEETS(13).cells(37, 3).value = "=SUMA(C31:C36)"
        wb.SHEETS(13).cells(39, 3).value = "=C28-C37"
        wb.SHEETS(13).cells(44, 3).value = "=C39-C42"
        wb.SHEETS(13).cells(57, 3).value = "=SUMA(C47:C56)"
        wb.SHEETS(13).cells(59, 3).value = "=C44-C57"
        wb.SHEETS(13).cells(61, 3).value = "=C59-C60"
        wb.SHEETS(13).cells(63, 3).value = "=C61-C62"
        
        wb.SHEETS(13).cells(4, 6).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,3,FALSO)"
        wb.SHEETS(13).cells(5, 6).value = "=RPA!E7"

        wb.SHEETS(13).cells(9, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,8,FALSO)"
        wb.SHEETS(13).cells(10, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,10,FALSO)"
        wb.SHEETS(13).cells(11, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,11,FALSO)"
        wb.SHEETS(13).cells(12, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,13,FALSO)"
        wb.SHEETS(13).cells(13, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,14,FALSO)"
        wb.SHEETS(13).cells(18, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,18,FALSO)"
        wb.SHEETS(13).cells(19, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,19,FALSO)"
        wb.SHEETS(13).cells(20, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,20,FALSO)"
        wb.SHEETS(13).cells(21, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,22,FALSO)"
        wb.SHEETS(13).cells(22, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,24,FALSO)"
        wb.SHEETS(13).cells(23, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,26,FALSO)"
        wb.SHEETS(13).cells(24, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,28,FALSO)"
        wb.SHEETS(13).cells(31, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,33,FALSO)"
        wb.SHEETS(13).cells(32, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,34,FALSO)"
        wb.SHEETS(13).cells(33, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,35,FALSO)"
        wb.SHEETS(13).cells(34, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,36,FALSO)"
        wb.SHEETS(13).cells(35, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,37,FALSO)"
        wb.SHEETS(13).cells(42, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,42,FALSO)"
        wb.SHEETS(13).cells(47, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,46,FALSO)"
        wb.SHEETS(13).cells(48, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,47,FALSO)"
        wb.SHEETS(13).cells(49, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,48,FALSO)"
        wb.SHEETS(13).cells(50, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,49,FALSO)"
        wb.SHEETS(13).cells(51, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,50,FALSO)"
        wb.SHEETS(13).cells(52, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,51,FALSO)"
        wb.SHEETS(13).cells(53, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,52,FALSO)"
        wb.SHEETS(13).cells(54, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,53,FALSO)"
        wb.SHEETS(13).cells(55, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,54,FALSO)"
        wb.SHEETS(13).cells(60, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,59,FALSO)"
        wb.SHEETS(13).cells(62, 3).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,63,FALSO)"

        wb.SHEETS(13).cells(9, 4).value = "=SI(ESERROR(C9*1/$C$15),0,C9*1/$C$15)"
        wb.SHEETS(13).cells(10, 4).value = "=SI(ESERROR(C10*1/$C$15),0,C10*1/$C$15)"
        wb.SHEETS(13).cells(11, 4).value = "=SI(ESERROR(C11*1/$C$15),0,C11*1/$C$15)"
        wb.SHEETS(13).cells(12, 4).value = "=SI(ESERROR(C12*1/$C$15),0,C12*1/$C$15)"
        wb.SHEETS(13).cells(13, 4).value = "=SI(ESERROR(C13*1/$C$15),0,C13*1/$C$15)"
        wb.SHEETS(13).cells(15, 4).value = "=SI(ESERROR(C15*1/$C$15),0,C15*1/$C$15)"
        wb.SHEETS(13).cells(18, 4).value = "=SI(ESERROR(C18*1/$C$15),0,C18*1/$C$15)"
        wb.SHEETS(13).cells(19, 4).value = "=SI(ESERROR(C19*1/$C$15),0,C19*1/$C$15)"
        wb.SHEETS(13).cells(20, 4).value = "=SI(ESERROR(C20*1/$C$15),0,C20*1/$C$15)"
        wb.SHEETS(13).cells(21, 4).value = "=SI(ESERROR(C21*1/$C$15),0,C21*1/$C$15)"
        wb.SHEETS(13).cells(22, 4).value = "=SI(ESERROR(C22*1/$C$15),0,C22*1/$C$15)"
        wb.SHEETS(13).cells(23, 4).value = "=SI(ESERROR(C23*1/$C$15),0,C23*1/$C$15)"
        wb.SHEETS(13).cells(24, 4).value = "=SI(ESERROR(C24*1/$C$15),0,C24*1/$C$15)"
        wb.SHEETS(13).cells(26, 4).value = "=SI(ESERROR(C26*1/$C$15),0,C26*1/$C$15)"
        wb.SHEETS(13).cells(28, 4).value = "=SI(ESERROR(C28*1/$C$15),0,C28*1/$C$15)"
        wb.SHEETS(13).cells(31, 4).value = "=SI(ESERROR(C31*1/$C$15),0,C31*1/$C$15)"
        wb.SHEETS(13).cells(32, 4).value = "=SI(ESERROR(C32*1/$C$15),0,C32*1/$C$15)"
        wb.SHEETS(13).cells(33, 4).value = "=SI(ESERROR(C33*1/$C$15),0,C33*1/$C$15)"
        wb.SHEETS(13).cells(34, 4).value = "=SI(ESERROR(C34*1/$C$15),0,C34*1/$C$15)"
        wb.SHEETS(13).cells(35, 4).value = "=SI(ESERROR(C35*1/$C$15),0,C35*1/$C$15)"
        wb.SHEETS(13).cells(37, 4).value = "=SI(ESERROR(C37*1/$C$15),0,C37*1/$C$15)"
        wb.SHEETS(13).cells(39, 4).value = "=SI(ESERROR(C39*1/$C$15),0,C39*1/$C$15)"
        wb.SHEETS(13).cells(42, 4).value = "=SI(ESERROR(C42*1/$C$15),0,C42*1/$C$15)"
        wb.SHEETS(13).cells(44, 4).value = "=SI(ESERROR(C44*1/$C$15),0,C44*1/$C$15)"
        wb.SHEETS(13).cells(47, 4).value = "=SI(ESERROR(C47*1/$C$15),0,C47*1/$C$15)"
        wb.SHEETS(13).cells(48, 4).value = "=SI(ESERROR(C48*1/$C$15),0,C48*1/$C$15)"
        wb.SHEETS(13).cells(49, 4).value = "=SI(ESERROR(C49*1/$C$15),0,C49*1/$C$15)"
        wb.SHEETS(13).cells(50, 4).value = "=SI(ESERROR(C50*1/$C$15),0,C50*1/$C$15)"
        wb.SHEETS(13).cells(51, 4).value = "=SI(ESERROR(C51*1/$C$15),0,C51*1/$C$15)"
        wb.SHEETS(13).cells(52, 4).value = "=SI(ESERROR(C52*1/$C$15),0,C52*1/$C$15)"
        wb.SHEETS(13).cells(53, 4).value = "=SI(ESERROR(C53*1/$C$15),0,C53*1/$C$15)"
        wb.SHEETS(13).cells(54, 4).value = "=SI(ESERROR(C54*1/$C$15),0,C54*1/$C$15)"
        wb.SHEETS(13).cells(55, 4).value = "=SI(ESERROR(C55*1/$C$15),0,C55*1/$C$15)"
        wb.SHEETS(13).cells(60, 4).value = "=SI(ESERROR(C60*1/$C$15),0,C60*1/$C$15)"
        wb.SHEETS(13).cells(62, 4).value = "=SI(ESERROR(C62*1/$C$15),0,C62*1/$C$15)"
        wb.SHEETS(13).cells(57, 4).value = "=SI(ESERROR(C57*1/$C$15),0,C57*1/$C$15)"
        wb.SHEETS(13).cells(59, 4).value = "=SI(ESERROR(C59*1/$C$15),0,C59*1/$C$15)"
        wb.SHEETS(13).cells(61, 4).value = "=SI(ESERROR(C61*1/$C$15),0,C61*1/$C$15)"
        wb.SHEETS(13).cells(63, 4).value = "=SI(ESERROR(C63*1/$C$15),0,C63*1/$C$15)"

        wb.SHEETS(13).cells(9, 5).value = "=SI(ESERROR(C9*1/$F$5),0,C9*1/$F$5)"
        wb.SHEETS(13).cells(10, 5).value = "=SI(ESERROR(C10*1/$F$5),0,C10*1/$F$5)"
        wb.SHEETS(13).cells(11, 5).value = "=SI(ESERROR(C11*1/$F$5),0,C11*1/$F$5)"
        wb.SHEETS(13).cells(12, 5).value = "=SI(ESERROR(C12*1/$F$5),0,C12*1/$F$5)"
        wb.SHEETS(13).cells(13, 5).value = "=SI(ESERROR(C13*1/$F$5),0,C13*1/$F$5)"
        wb.SHEETS(13).cells(18, 5).value = "=SI(ESERROR(C18*1/$F$5),0,C18*1/$F$5)"
        wb.SHEETS(13).cells(19, 5).value = "=SI(ESERROR(C19*1/$F$5),0,C19*1/$F$5)"
        wb.SHEETS(13).cells(20, 5).value = "=SI(ESERROR(C20*1/$F$5),0,C20*1/$F$5)"
        wb.SHEETS(13).cells(21, 5).value = "=SI(ESERROR(C21*1/$F$5),0,C21*1/$F$5)"
        wb.SHEETS(13).cells(22, 5).value = "=SI(ESERROR(C22*1/$F$5),0,C22*1/$F$5)"
        wb.SHEETS(13).cells(23, 5).value = "=SI(ESERROR(C23*1/$F$5),0,C23*1/$F$5)"
        wb.SHEETS(13).cells(24, 5).value = "=SI(ESERROR(C24*1/$F$5),0,C24*1/$F$5)"
        wb.SHEETS(13).cells(31, 5).value = "=SI(ESERROR(C31*1/$F$5),0,C31*1/$F$5)"
        wb.SHEETS(13).cells(32, 5).value = "=SI(ESERROR(C32*1/$F$5),0,C32*1/$F$5)"
        wb.SHEETS(13).cells(33, 5).value = "=SI(ESERROR(C33*1/$F$5),0,C33*1/$F$5)"
        wb.SHEETS(13).cells(34, 5).value = "=SI(ESERROR(C34*1/$F$5),0,C34*1/$F$5)"
        wb.SHEETS(13).cells(35, 5).value = "=SI(ESERROR(C35*1/$F$5),0,C35*1/$F$5)"
        wb.SHEETS(13).cells(42, 5).value = "=SI(ESERROR(C42*1/$F$5),0,C42*1/$F$5)"
        wb.SHEETS(13).cells(47, 5).value = "=SI(ESERROR(C47*1/$F$5),0,C47*1/$F$5)"
        wb.SHEETS(13).cells(48, 5).value = "=SI(ESERROR(C48*1/$F$5),0,C48*1/$F$5)"
        wb.SHEETS(13).cells(49, 5).value = "=SI(ESERROR(C49*1/$F$5),0,C49*1/$F$5)"
        wb.SHEETS(13).cells(50, 5).value = "=SI(ESERROR(C50*1/$F$5),0,C50*1/$F$5)"
        wb.SHEETS(13).cells(51, 5).value = "=SI(ESERROR(C51*1/$F$5),0,C51*1/$F$5)"
        wb.SHEETS(13).cells(52, 5).value = "=SI(ESERROR(C52*1/$F$5),0,C52*1/$F$5)"
        wb.SHEETS(13).cells(53, 5).value = "=SI(ESERROR(C53*1/$F$5),0,C53*1/$F$5)"
        wb.SHEETS(13).cells(54, 5).value = "=SI(ESERROR(C54*1/$F$5),0,C54*1/$F$5)"
        wb.SHEETS(13).cells(55, 5).value = "=SI(ESERROR(C55*1/$F$5),0,C55*1/$F$5)"
        wb.SHEETS(13).cells(60, 5).value = "=SI(ESERROR(C60*1/$F$5),0,C60*1/$F$5)"
        wb.SHEETS(13).cells(62, 5).value = "=SI(ESERROR(C62*1/$F$5),0,C62*1/$F$5)"
        wb.SHEETS(13).cells(15, 5).value = "=SI(ESERROR(C15*1/$F$5),0,C15*1/$F$5)"
        wb.SHEETS(13).cells(26, 5).value = "=SI(ESERROR(C26*1/$F$5),0,C26*1/$F$5)"
        wb.SHEETS(13).cells(28, 5).value = "=SI(ESERROR(C28*1/$F$5),0,C28*1/$F$5)"
        wb.SHEETS(13).cells(37, 5).value = "=SI(ESERROR(C37*1/$F$5),0,C37*1/$F$5)"
        wb.SHEETS(13).cells(39, 5).value = "=SI(ESERROR(C39*1/$F$5),0,C39*1/$F$5)"
        wb.SHEETS(13).cells(44, 5).value = "=SI(ESERROR(C44*1/$F$5),0,C44*1/$F$5)"
        wb.SHEETS(13).cells(57, 5).value = "=SI(ESERROR(C57*1/$F$5),0,C57*1/$F$5)"
        wb.SHEETS(13).cells(59, 5).value = "=SI(ESERROR(C59*1/$F$5),0,C59*1/$F$5)"
        wb.SHEETS(13).cells(61, 5).value = "=SI(ESERROR(C61*1/$F$5),0,C61*1/$F$5)"
        wb.SHEETS(13).cells(63, 5).value = "=SI(ESERROR(C63*1/$F$5),0,C63*1/$F$5)"

        wb.SHEETS(13).cells(9, 6).value = "=SI(ESERROR(C9*1/$F$4),0,C9*1/$F$4)"
        wb.SHEETS(13).cells(10, 6).value = "=SI(ESERROR(C10*1/$F$4),0,C10*1/$F$4)"
        wb.SHEETS(13).cells(11, 6).value = "=SI(ESERROR(C11*1/$F$4),0,C11*1/$F$4)"
        wb.SHEETS(13).cells(12, 6).value = "=SI(ESERROR(C12*1/$F$4),0,C12*1/$F$4)"
        wb.SHEETS(13).cells(13, 6).value = "=SI(ESERROR(C13*1/$F$4),0,C13*1/$F$4)"
        wb.SHEETS(13).cells(18, 6).value = "=SI(ESERROR(C18*1/$F$4),0,C18*1/$F$4)"
        wb.SHEETS(13).cells(19, 6).value = "=SI(ESERROR(C19*1/$F$4),0,C19*1/$F$4)"
        wb.SHEETS(13).cells(20, 6).value = "=SI(ESERROR(C20*1/$F$4),0,C20*1/$F$4)"
        wb.SHEETS(13).cells(21, 6).value = "=SI(ESERROR(C21*1/$F$4),0,C21*1/$F$4)"
        wb.SHEETS(13).cells(22, 6).value = "=SI(ESERROR(C22*1/$F$4),0,C22*1/$F$4)"
        wb.SHEETS(13).cells(23, 6).value = "=SI(ESERROR(C23*1/$F$4),0,C23*1/$F$4)"
        wb.SHEETS(13).cells(24, 6).value = "=SI(ESERROR(C24*1/$F$4),0,C24*1/$F$4)"
        wb.SHEETS(13).cells(31, 6).value = "=SI(ESERROR(C31*1/$F$4),0,C31*1/$F$4)"
        wb.SHEETS(13).cells(32, 6).value = "=SI(ESERROR(C32*1/$F$4),0,C32*1/$F$4)"
        wb.SHEETS(13).cells(33, 6).value = "=SI(ESERROR(C33*1/$F$4),0,C33*1/$F$4)"
        wb.SHEETS(13).cells(34, 6).value = "=SI(ESERROR(C34*1/$F$4),0,C34*1/$F$4)"
        wb.SHEETS(13).cells(35, 6).value = "=SI(ESERROR(C35*1/$F$4),0,C35*1/$F$4)"
        wb.SHEETS(13).cells(42, 6).value = "=SI(ESERROR(C42*1/$F$4),0,C42*1/$F$4)"
        wb.SHEETS(13).cells(47, 6).value = "=SI(ESERROR(C47*1/$F$4),0,C47*1/$F$4)"
        wb.SHEETS(13).cells(48, 6).value = "=SI(ESERROR(C48*1/$F$4),0,C48*1/$F$4)"
        wb.SHEETS(13).cells(49, 6).value = "=SI(ESERROR(C49*1/$F$4),0,C49*1/$F$4)"
        wb.SHEETS(13).cells(50, 6).value = "=SI(ESERROR(C50*1/$F$4),0,C50*1/$F$4)"
        wb.SHEETS(13).cells(51, 6).value = "=SI(ESERROR(C51*1/$F$4),0,C51*1/$F$4)"
        wb.SHEETS(13).cells(52, 6).value = "=SI(ESERROR(C52*1/$F$4),0,C52*1/$F$4)"
        wb.SHEETS(13).cells(53, 6).value = "=SI(ESERROR(C53*1/$F$4),0,C53*1/$F$4)"
        wb.SHEETS(13).cells(54, 6).value = "=SI(ESERROR(C54*1/$F$4),0,C54*1/$F$4)"
        wb.SHEETS(13).cells(55, 6).value = "=SI(ESERROR(C55*1/$F$4),0,C55*1/$F$4)"
        wb.SHEETS(13).cells(60, 6).value = "=SI(ESERROR(C60*1/$F$4),0,C60*1/$F$4)"
        wb.SHEETS(13).cells(62, 6).value = "=SI(ESERROR(C62*1/$F$4),0,C62*1/$F$4)"
        wb.SHEETS(13).cells(15, 6).value = "=SI(ESERROR(C15*1/$F$4),0,C15*1/$F$4)"
        wb.SHEETS(13).cells(26, 6).value = "=SI(ESERROR(C26*1/$F$4),0,C26*1/$F$4)"
        wb.SHEETS(13).cells(28, 6).value = "=SI(ESERROR(C28*1/$F$4),0,C28*1/$F$4)"
        wb.SHEETS(13).cells(37, 6).value = "=SI(ESERROR(C37*1/$F$4),0,C37*1/$F$4)"
        wb.SHEETS(13).cells(39, 6).value = "=SI(ESERROR(C39*1/$F$4),0,C39*1/$F$4)"
        wb.SHEETS(13).cells(44, 6).value = "=SI(ESERROR(C44*1/$F$4),0,C44*1/$F$4)"
        wb.SHEETS(13).cells(57, 6).value = "=SI(ESERROR(C57*1/$F$4),0,C57*1/$F$4)"
        wb.SHEETS(13).cells(59, 6).value = "=SI(ESERROR(C59*1/$F$4),0,C59*1/$F$4)"
        wb.SHEETS(13).cells(61, 6).value = "=SI(ESERROR(C61*1/$F$4),0,C61*1/$F$4)"
        wb.SHEETS(13).cells(63, 6).value = "=SI(ESERROR(C63*1/$F$4),0,C63*1/$F$4)"

        wb.SHEETS(13).cells(65, 2).value = "DATOS ESTADISTICOS"
        wb.SHEETS(13).cells(65, 2).FONT.BOLD = True
        wb.SHEETS(13).cells(66, 2).value = "Kilometros Programados"
        wb.SHEETS(13).cells(67, 2).value = "Kilometros Recorridos"
        wb.SHEETS(13).cells(68, 2).value = "Kms. Prom.. P/Carro"
        wb.SHEETS(13).cells(69, 2).value = "Costo diesel por litro"
        wb.SHEETS(13).cells(70, 2).value = "Total Lts Diesel"
        wb.SHEETS(13).cells(71, 2).value = "Rendimiento Kms/Lts Diesel"
        wb.SHEETS(13).cells(72, 2).value = "Costo diesel/Km"

        wb.SHEETS(13).cells(67, 6).value = "=F4"
        wb.SHEETS(13).cells(68, 6).value = "=F67/F5"
        wb.SHEETS(13).cells(69, 6).value = "=RPA!$J$8"
        wb.SHEETS(13).cells(70, 6).value = "=C18/F69"
        wb.SHEETS(13).cells(71, 6).value = "=F67/F70"
        wb.SHEETS(13).cells(72, 6).value = "=C18/F67"



        wb.SHEETS(13).columns(2).columnwidth = 44
        For i = 3 To 6
            wb.SHEETS(13).columns(i).columnwidth = 12
            wb.SHEETS(13).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(13).columns(4).NumberFormat = "0.00%"

        wb.SHEETS(13).name = "EDO Resultados Kms Coord"

    End Sub
    Sub ResultadosCoordinado()
        Dim rng As Integer = 2
        'Dim strArchivo As String = "" 'Temporal
        'strArchivo = "C:\Informe.xlsx" 'Temporal

        'xl = CreateObject("Excel.Application") 'Temporal
        'xl.Visible = True 'Temporal
        'xl.Workbooks.open(strArchivo) 'Temporal
        'wb = xl.activeworkbook 'Temporal
        
        wb.SHEETS(6).select()
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        wb.SHEETS(7).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(7).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(7).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(7).cells(rng, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(7).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(7).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(7).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(7).cells(rng, 2).value = "Estado de Resultados Global CONSORCIO OPTRA"
        rng = rng + 2

        'AGREGA DEFINICIONES
        wb.SHEETS(7).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(7).cells(rng, 3).value = "ENERO"
        wb.SHEETS(7).cells(rng, 4).value = "FEBRERO"
        wb.SHEETS(7).cells(rng, 5).value = "MARZO"
        wb.SHEETS(7).cells(rng, 6).value = "ABRIL"
        wb.SHEETS(7).cells(rng, 7).value = "MAYO"
        wb.SHEETS(7).cells(rng, 8).value = "JUNIO"
        wb.SHEETS(7).cells(rng, 9).value = "JULIO"
        wb.SHEETS(7).cells(rng, 10).value = "AGOSTO"
        wb.SHEETS(7).cells(rng, 11).value = "SEPTIEMBRE"
        wb.SHEETS(7).cells(rng, 12).value = "OCTUBRE"
        wb.SHEETS(7).cells(rng, 13).value = "NOVIEMBRE"
        wb.SHEETS(7).cells(rng, 14).value = "DICIEMBRE"
        wb.SHEETS(7).cells(rng, 15).value = "ACUMULADO"

        For I = 2 To 15
            wb.SHEETS(7).cells(rng, I).font.bold = True
            wb.SHEETS(7).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(7).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(7).CELLS(rng, I).WrapText = True
            wb.SHEETS(7).CELLS(rng, I).Orientation = 0
            wb.SHEETS(7).CELLS(rng, I).AddIndent = False
            wb.SHEETS(7).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(7).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(7).CELLS(rng, I).MergeCells = False
            wb.SHEETS(7).CELLS(rng, I).ReadingOrder = -5002
        Next

        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(7).cells(9, 2).value = "Ingresos Boletos de Abordo"
        wb.SHEETS(7).cells(10, 2).value = "Ingresos Pagobus"
        wb.SHEETS(7).cells(11, 2).value = "Ingresos Red Integral Optibus"
        wb.SHEETS(7).cells(12, 2).value = "Otros Ingresos"
        wb.SHEETS(7).cells(13, 2).value = "Servicios Especiales"
        wb.SHEETS(7).cells(15, 2).value = "Total de Ingresos"


        wb.SHEETS(7).Range("C15:O15").INTERIOR.ThemeColor = 1
        wb.SHEETS(7).Range("C15:O15").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(7).Range("C26:O26").INTERIOR.ThemeColor = 1
        wb.SHEETS(7).Range("C26:O26").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(7).Range("C37:O37").INTERIOR.ThemeColor = 1
        wb.SHEETS(7).Range("C37:O37").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(7).Range("C57:O57").INTERIOR.ThemeColor = 1
        wb.SHEETS(7).Range("C57:O57").INTERIOR.TintAndShade = -0.0499893185216834

        wb.SHEETS(7).Range("C28:O28").INTERIOR.ThemeColor = 1
        wb.SHEETS(7).Range("C28:O28").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(7).Range("C39:O39").INTERIOR.ThemeColor = 1
        wb.SHEETS(7).Range("C39:O39").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(7).Range("C44:O44").INTERIOR.ThemeColor = 1
        wb.SHEETS(7).Range("C44:O44").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(7).Range("C59:O59").INTERIOR.ThemeColor = 1
        wb.SHEETS(7).Range("C59:O59").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(7).Range("C61:O61").INTERIOR.ThemeColor = 1
        wb.SHEETS(7).Range("C61:O61").INTERIOR.TintAndShade = -0.149998474074526
        wb.SHEETS(7).Range("C63:O63").INTERIOR.ThemeColor = 1
        wb.SHEETS(7).Range("C63:O63").INTERIOR.TintAndShade = -0.149998474074526
        
        wb.SHEETS(7).cells(17, 2).value = "COSTOS DIRECTOS"
        wb.SHEETS(7).cells(18, 2).value = "Diesel"
        wb.SHEETS(7).cells(19, 2).value = "Sueldos y Salarios"
        wb.SHEETS(7).cells(20, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(7).cells(21, 2).value = "Refacciones"
        wb.SHEETS(7).cells(22, 2).value = "Mantenimiento y Reparación de Autobuses"
        wb.SHEETS(7).cells(23, 2).value = "Llantas Nuevas"
        wb.SHEETS(7).cells(24, 2).value = "Llantas Vitalizadas"
        wb.SHEETS(7).cells(26, 2).value = "Total de Costos Directos"

        wb.SHEETS(7).cells(28, 2).value = "UTILIDAD BRUTA"

        wb.SHEETS(7).cells(30, 2).value = "COSTOS INDIRECTOS DE OPERACIÓN"
        wb.SHEETS(7).cells(31, 2).value = "Gastos de Mantenimiento"
        wb.SHEETS(7).cells(32, 2).value = "Gastos de Operación y Servicios"
        wb.SHEETS(7).cells(33, 2).value = "Gastos de Seguro Interno"
        wb.SHEETS(7).cells(34, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(7).cells(35, 2).value = "Gastos Diversos de Operación"
        wb.SHEETS(7).cells(37, 2).value = "Total de Costos Indirectos"

        wb.SHEETS(7).cells(39, 2).value = "UTILIDAD MARGINAL"

        wb.SHEETS(7).cells(41, 2).value = "COSTOS INDIRECTOS DE ADMINISTRACIÓN"
        wb.SHEETS(7).cells(42, 2).value = "Gastos de Administración"

        wb.SHEETS(7).cells(44, 2).value = "UTILIDAD ANTES DE RESERVAS"

        wb.SHEETS(7).cells(46, 2).value = "RESERVAS"
        wb.SHEETS(7).cells(47, 2).value = "Reserva para Aguinaldo"
        wb.SHEETS(7).cells(48, 2).value = "Reserva para Tenencias y Refrendos"
        wb.SHEETS(7).cells(49, 2).value = "Reserva para Prima de Seguros"
        wb.SHEETS(7).cells(50, 2).value = "Fondo para Renovación de Equipo"
        wb.SHEETS(7).cells(51, 2).value = "Aportaciones al Fideicomiso"
        wb.SHEETS(7).cells(52, 2).value = "Reserva para Capacitación Adiestramiento Seguridad e Higiene y Otros"
        wb.SHEETS(7).cells(53, 2).value = "Reserva  PTU"
        wb.SHEETS(7).cells(54, 2).value = "Reserva para Uniformes y Otros Gastos Mayores"
        wb.SHEETS(7).cells(55, 2).value = "Reserva para Adquisición de Activos"

        wb.SHEETS(7).cells(57, 2).value = "Total de Reservas"

        wb.SHEETS(7).cells(59, 2).value = "RESULTADO ANTES DE DOCUMENTOS"
        wb.SHEETS(7).cells(60, 2).value = "Documento de Unidades"
        wb.SHEETS(7).cells(61, 2).value = "RESULTADO ANTES IMPUESTOS"
        wb.SHEETS(7).cells(62, 2).value = "Impuesto Sobre la Renta"
        wb.SHEETS(7).cells(63, 2).value = "RESULTADO NETO"

        For i = 9 To 63
            wb.SHEETS(7).cells(i, 15).value = "=SUMA(C" & i & ":N" & i & ")"
        Next
        wb.SHEETS(7).cells(16, 15).value = ""
        wb.SHEETS(7).cells(27, 15).value = ""
        wb.SHEETS(7).cells(29, 15).value = ""
        wb.SHEETS(7).cells(38, 15).value = ""
        wb.SHEETS(7).cells(40, 15).value = ""
        wb.SHEETS(7).cells(43, 15).value = ""
        wb.SHEETS(7).cells(45, 15).value = ""
        wb.SHEETS(7).cells(56, 15).value = ""
        wb.SHEETS(7).cells(58, 15).value = ""
        wb.SHEETS(7).cells(17, 15).value = ""
        wb.SHEETS(7).cells(30, 15).value = ""
        wb.SHEETS(7).cells(41, 15).value = ""
        wb.SHEETS(7).cells(46, 15).value = ""
        wb.SHEETS(7).cells(14, 15).value = ""
        wb.SHEETS(7).cells(25, 15).value = ""
        wb.SHEETS(7).cells(36, 15).value = ""

        wb.SHEETS(7).cells(15, 3).value = "=SUMA(C9:C14)"
        wb.SHEETS(7).cells(15, 4).value = "=SUMA(D9:D14)"
        wb.SHEETS(7).cells(15, 5).value = "=SUMA(E9:E14)"
        wb.SHEETS(7).cells(15, 6).value = "=SUMA(F9:F14)"
        wb.SHEETS(7).cells(15, 7).value = "=SUMA(G9:G14)"
        wb.SHEETS(7).cells(15, 8).value = "=SUMA(H9:H14)"
        wb.SHEETS(7).cells(15, 9).value = "=SUMA(I9:I14)"
        wb.SHEETS(7).cells(15, 10).value = "=SUMA(J9:J14)"
        wb.SHEETS(7).cells(15, 11).value = "=SUMA(K9:K14)"
        wb.SHEETS(7).cells(15, 12).value = "=SUMA(L9:L14)"
        wb.SHEETS(7).cells(15, 13).value = "=SUMA(M9:M14)"
        wb.SHEETS(7).cells(15, 14).value = "=SUMA(N9:N14)"
        wb.SHEETS(7).cells(15, 15).value = "=SUMA(O9:O14)"

      

        wb.SHEETS(7).cells(26, 3).value = "=SUMA(C18:C25)"
        wb.SHEETS(7).cells(26, 4).value = "=SUMA(D18:D25)"
        wb.SHEETS(7).cells(26, 5).value = "=SUMA(E18:E25)"
        wb.SHEETS(7).cells(26, 6).value = "=SUMA(F18:F25)"
        wb.SHEETS(7).cells(26, 7).value = "=SUMA(G18:G25)"
        wb.SHEETS(7).cells(26, 8).value = "=SUMA(H18:H25)"
        wb.SHEETS(7).cells(26, 9).value = "=SUMA(I18:I25)"
        wb.SHEETS(7).cells(26, 10).value = "=SUMA(J18:J25)"
        wb.SHEETS(7).cells(26, 11).value = "=SUMA(K18:K25)"
        wb.SHEETS(7).cells(26, 12).value = "=SUMA(L18:L25)"
        wb.SHEETS(7).cells(26, 13).value = "=SUMA(M18:M25)"
        wb.SHEETS(7).cells(26, 14).value = "=SUMA(N18:N25)"
        wb.SHEETS(7).cells(26, 15).value = "=SUMA(O18:O25)"

        wb.SHEETS(7).cells(28, 3).value = "=C15-C26"
        wb.SHEETS(7).cells(28, 4).value = "=D15-D26"
        wb.SHEETS(7).cells(28, 5).value = "=E15-E26"
        wb.SHEETS(7).cells(28, 6).value = "=F15-F26"
        wb.SHEETS(7).cells(28, 7).value = "=G15-G26"
        wb.SHEETS(7).cells(28, 8).value = "=H15-H26"
        wb.SHEETS(7).cells(28, 9).value = "=I15-I26"
        wb.SHEETS(7).cells(28, 10).value = "=J15-J26"
        wb.SHEETS(7).cells(28, 11).value = "=K15-K26"
        wb.SHEETS(7).cells(28, 12).value = "=L15-L26"
        wb.SHEETS(7).cells(28, 13).value = "=M15-M26"
        wb.SHEETS(7).cells(28, 14).value = "=N15-N26"
        wb.SHEETS(7).cells(28, 15).value = "=O15-O26"

        wb.SHEETS(7).cells(37, 3).value = "=SUMA(C31:C36)"
        wb.SHEETS(7).cells(37, 4).value = "=SUMA(D31:D36)"
        wb.SHEETS(7).cells(37, 5).value = "=SUMA(E31:E36)"
        wb.SHEETS(7).cells(37, 6).value = "=SUMA(F31:F36)"
        wb.SHEETS(7).cells(37, 7).value = "=SUMA(G31:G36)"
        wb.SHEETS(7).cells(37, 8).value = "=SUMA(H31:H36)"
        wb.SHEETS(7).cells(37, 9).value = "=SUMA(I31:I36)"
        wb.SHEETS(7).cells(37, 10).value = "=SUMA(J31:J36)"
        wb.SHEETS(7).cells(37, 11).value = "=SUMA(K31:K36)"
        wb.SHEETS(7).cells(37, 12).value = "=SUMA(L18:L36)"
        wb.SHEETS(7).cells(37, 13).value = "=SUMA(M31:M36)"
        wb.SHEETS(7).cells(37, 14).value = "=SUMA(N31:N36)"
        wb.SHEETS(7).cells(37, 15).value = "=SUMA(O31:O36)"

        wb.SHEETS(7).cells(39, 3).value = "=C28-C37"
        wb.SHEETS(7).cells(39, 4).value = "=D28-D37"
        wb.SHEETS(7).cells(39, 5).value = "=E28-E37"
        wb.SHEETS(7).cells(39, 6).value = "=F28-F37"
        wb.SHEETS(7).cells(39, 7).value = "=G28-G37"
        wb.SHEETS(7).cells(39, 8).value = "=H28-H37"
        wb.SHEETS(7).cells(39, 9).value = "=I28-I37"
        wb.SHEETS(7).cells(39, 10).value = "=J28-J37"
        wb.SHEETS(7).cells(39, 11).value = "=K28-K37"
        wb.SHEETS(7).cells(39, 12).value = "=L28-L37"
        wb.SHEETS(7).cells(39, 13).value = "=M28-M37"
        wb.SHEETS(7).cells(39, 14).value = "=N28-N37"
        wb.SHEETS(7).cells(39, 15).value = "=O28-O37"

        wb.SHEETS(7).cells(44, 3).value = "=C39-C42"
        wb.SHEETS(7).cells(44, 4).value = "=D39-D42"
        wb.SHEETS(7).cells(44, 5).value = "=E39-E42"
        wb.SHEETS(7).cells(44, 6).value = "=F39-F42"
        wb.SHEETS(7).cells(44, 7).value = "=G39-G42"
        wb.SHEETS(7).cells(44, 8).value = "=H39-H42"
        wb.SHEETS(7).cells(44, 9).value = "=I39-I42"
        wb.SHEETS(7).cells(44, 10).value = "=J39-J42"
        wb.SHEETS(7).cells(44, 11).value = "=K39-K42"
        wb.SHEETS(7).cells(44, 12).value = "=L39-L42"
        wb.SHEETS(7).cells(44, 13).value = "=M39-M42"
        wb.SHEETS(7).cells(44, 14).value = "=N39-N42"
        wb.SHEETS(7).cells(44, 15).value = "=O39-O42"

        wb.SHEETS(7).cells(57, 3).value = "=SUMA(C47:C56)"
        wb.SHEETS(7).cells(57, 4).value = "=SUMA(D47:D56)"
        wb.SHEETS(7).cells(57, 5).value = "=SUMA(E47:E56)"
        wb.SHEETS(7).cells(57, 6).value = "=SUMA(F47:F56)"
        wb.SHEETS(7).cells(57, 7).value = "=SUMA(G47:G56)"
        wb.SHEETS(7).cells(57, 8).value = "=SUMA(H47:H56)"
        wb.SHEETS(7).cells(57, 9).value = "=SUMA(I47:I56)"
        wb.SHEETS(7).cells(57, 10).value = "=SUMA(J47:J56)"
        wb.SHEETS(7).cells(57, 11).value = "=SUMA(K47:K56)"
        wb.SHEETS(7).cells(57, 12).value = "=SUMA(L47:L56)"
        wb.SHEETS(7).cells(57, 13).value = "=SUMA(M47:M56)"
        wb.SHEETS(7).cells(57, 14).value = "=SUMA(N47:N56)"
        wb.SHEETS(7).cells(57, 15).value = "=SUMA(O47:O56)"

        wb.SHEETS(7).cells(59, 3).value = "=C44-C57"
        wb.SHEETS(7).cells(59, 4).value = "=D44-D57"
        wb.SHEETS(7).cells(59, 5).value = "=E44-E57"
        wb.SHEETS(7).cells(59, 6).value = "=F44-F57"
        wb.SHEETS(7).cells(59, 7).value = "=G44-G57"
        wb.SHEETS(7).cells(59, 8).value = "=H44-H57"
        wb.SHEETS(7).cells(59, 9).value = "=I44-I57"
        wb.SHEETS(7).cells(59, 10).value = "=J44-J57"
        wb.SHEETS(7).cells(59, 11).value = "=K44-K57"
        wb.SHEETS(7).cells(59, 12).value = "=L44-L57"
        wb.SHEETS(7).cells(59, 13).value = "=M44-M57"
        wb.SHEETS(7).cells(59, 14).value = "=N44-N57"
        wb.SHEETS(7).cells(59, 15).value = "=O44-O57"

        wb.SHEETS(7).cells(61, 3).value = "=C59-C60"
        wb.SHEETS(7).cells(61, 4).value = "=D59-D60"
        wb.SHEETS(7).cells(61, 5).value = "=E59-E60"
        wb.SHEETS(7).cells(61, 6).value = "=F59-F60"
        wb.SHEETS(7).cells(61, 7).value = "=G59-G60"
        wb.SHEETS(7).cells(61, 8).value = "=H59-H60"
        wb.SHEETS(7).cells(61, 9).value = "=I59-I60"
        wb.SHEETS(7).cells(61, 10).value = "=J59-J60"
        wb.SHEETS(7).cells(61, 11).value = "=K59-K60"
        wb.SHEETS(7).cells(61, 12).value = "=L59-L60"
        wb.SHEETS(7).cells(61, 13).value = "=M59-M60"
        wb.SHEETS(7).cells(61, 14).value = "=N59-N60"
        wb.SHEETS(7).cells(61, 15).value = "=O59-O60"

        wb.SHEETS(7).cells(63, 3).value = "=C61-C62"
        wb.SHEETS(7).cells(63, 4).value = "=D61-D62"
        wb.SHEETS(7).cells(63, 5).value = "=E61-E62"
        wb.SHEETS(7).cells(63, 6).value = "=F61-F62"
        wb.SHEETS(7).cells(63, 7).value = "=G61-G62"
        wb.SHEETS(7).cells(63, 8).value = "=H61-H62"
        wb.SHEETS(7).cells(63, 9).value = "=I61-I62"
        wb.SHEETS(7).cells(63, 10).value = "=J61-J62"
        wb.SHEETS(7).cells(63, 11).value = "=K61-K62"
        wb.SHEETS(7).cells(63, 12).value = "=L61-L62"
        wb.SHEETS(7).cells(63, 13).value = "=M61-M62"
        wb.SHEETS(7).cells(63, 14).value = "=N61-N62"
        wb.SHEETS(7).cells(63, 15).value = "=O61-O62"

        wb.SHEETS(7).cells(9, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,8,FALSO)"
        wb.SHEETS(7).cells(10, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,10,FALSO)"
        wb.SHEETS(7).cells(11, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,11,FALSO)"
        wb.SHEETS(7).cells(12, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,13,FALSO)"
        wb.SHEETS(7).cells(13, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,14,FALSO)"
        For I = Col + 1 To 14
            For J = 9 To 13
                wb.SHEETS(7).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(7).cells(18, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,18,FALSO)"
        wb.SHEETS(7).cells(19, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,19,FALSO)"
        wb.SHEETS(7).cells(20, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,20,FALSO)"
        wb.SHEETS(7).cells(21, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,22,FALSO)"
        wb.SHEETS(7).cells(22, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,24,FALSO)"
        wb.SHEETS(7).cells(23, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,26,FALSO)"
        wb.SHEETS(7).cells(24, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,28,FALSO)"
        For I = Col + 1 To 14
            For J = 18 To 24
                wb.SHEETS(7).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(7).cells(31, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,33,FALSO)"
        wb.SHEETS(7).cells(32, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,34,FALSO)"
        wb.SHEETS(7).cells(33, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,35,FALSO)"
        wb.SHEETS(7).cells(34, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,36,FALSO)"
        wb.SHEETS(7).cells(35, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,37,FALSO)"
        For I = Col + 1 To 14
            For J = 31 To 35
                wb.SHEETS(7).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(7).cells(42, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,42,FALSO)"
        For I = Col + 1 To 14
            For J = 42 To 42
                wb.SHEETS(7).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(7).cells(47, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,46,FALSO)"
        wb.SHEETS(7).cells(48, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,47,FALSO)"
        wb.SHEETS(7).cells(49, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,48,FALSO)"
        wb.SHEETS(7).cells(50, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,49,FALSO)"
        wb.SHEETS(7).cells(51, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,50,FALSO)"
        wb.SHEETS(7).cells(52, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,51,FALSO)"
        wb.SHEETS(7).cells(53, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,52,FALSO)"
        wb.SHEETS(7).cells(54, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,53,FALSO)"
        wb.SHEETS(7).cells(55, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,54,FALSO)"
        For I = Col + 1 To 14
            For J = 47 To 55
                wb.SHEETS(7).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(7).cells(60, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,59,FALSO)"
        For I = Col + 1 To 14
            For J = 60 To 60
                wb.SHEETS(7).cells(J, I).value = 0
            Next
        Next
        wb.SHEETS(7).cells(62, Col).value = "=BUSCARV(" & Chr(34) & "Total Gral" & Chr(34) & ",RPA!E9:BQ1000,63,FALSO)"
        For I = Col + 1 To 14
            For J = 62 To 62
                wb.SHEETS(7).cells(J, I).value = 0
            Next
        Next

        wb.SHEETS(7).columns(2).columnwidth = 44
        For i = 3 To 15
            wb.SHEETS(7).columns(i).columnwidth = 12
            wb.SHEETS(7).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(7).name = "EDO Resultados Coordinado"


    End Sub
    Sub AjustaResultadoPorAutobus()
        Dim R15 As String = wb.SHEETS(6).cells(8, 6).value
        Dim R73 As String = wb.SHEETS(6).cells(9, 6).value
        Dim R9 As String = wb.SHEETS(6).cells(10, 6).value
        Dim R35 As String = wb.SHEETS(6).cells(11, 6).value
        Dim R66 As String = wb.SHEETS(6).cells(12, 6).value
        Dim R16A As String = wb.SHEETS(6).cells(13, 6).value
        Dim R77 As String = wb.SHEETS(6).cells(14, 6).value
        Dim R78 As String = wb.SHEETS(6).cells(15, 6).value
        Dim R1 As String = wb.SHEETS(6).cells(16, 6).value
        Dim R1X As String = wb.SHEETS(6).cells(17, 6).value
        Dim R11X As String = wb.SHEETS(6).cells(18, 6).value
        Dim R16 As String = wb.SHEETS(6).cells(19, 6).value
        Dim R17 As String = wb.SHEETS(6).cells(20, 6).value
        Dim R3 As String = wb.SHEETS(6).cells(21, 6).value
        Dim R53 As String = wb.SHEETS(6).cells(22, 6).value
        Dim R55 As String = wb.SHEETS(6).cells(23, 6).value
        Dim R86 As String = wb.SHEETS(6).cells(24, 6).value
        Dim ACG As String = wb.SHEETS(6).cells(25, 6).value
        Dim SPT As String = wb.SHEETS(6).cells(26, 6).value
        Dim AYT As String = wb.SHEETS(6).cells(27, 6).value

        Dim Ruta As String = ""
        Dim Ajuste As Double = 0

        wb.SHEETS(5).select()

        Dim Columna As Integer = NumColumna(lstMeses.Text.Trim)

        For i = 10 To 1000
            If wb.SHEETS(5).cells(i, 3).value <> "" Then
                Ruta = wb.sheets(5).cells(i, 5).value
                Select Case Ruta
                    Case "Ruta 15 Auxiliar"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R15
                    Case "Ruta 73 Auxiliar"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R73
                    Case "Ruta 9 Auxiliar"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R9
                    Case "Ruta 35 Alimentadora"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R35
                    Case "Ruta 66 Alimentadora"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R66
                    Case "Ruta 16 Alimentadora"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R16A
                    Case "Ruta 77"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R77
                    Case "Ruta 78"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R78
                    Case "Ruta 1"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R1
                    Case "Ruta 1 Autxiliar"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R1X
                    Case "Ruta 11 Auxiliar"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R11X
                    Case "Ruta 15 Auxiliar"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R15
                    Case "Ruta 16"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R16
                    Case "Ruta 17"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R17
                    Case "Ruta 3"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R3
                    Case "Ruta 53 Alimentadora"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R53
                    Case "Ruta 55"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R55
                    Case "Ruta 86"
                        Ajuste = wb.sheets(5).cells(i, 13).value * R86
                    Case "Centrales de Guanajuato"
                        Ajuste = wb.sheets(5).cells(i, 13).value * ACG
                    Case "Pasaje Terrestre"
                        Ajuste = wb.sheets(5).cells(i, 13).value * SPT
                    Case "Azules y Triangulo"
                        Ajuste = wb.sheets(5).cells(i, 13).value * AYT
                End Select
                wb.sheets(5).cells(i, 14).value = wb.sheets(5).cells(i, 13).value - Ajuste
                Ajuste = 0

                If wb.sheets(5).cells(i, 6).value = "AUS/SECTOR URBANO" Then
                    If wb.sheets(5).cells(i, 12).value > 0 Then
                        wb.sheets(5).cells(i, 15).value = AbonosMenosCargos(101) / wb.sheets(5).cells(1, 3).value
                        wb.sheets(5).cells(i, 16).value = AbonosMenosCargos(102) / wb.sheets(5).cells(1, 3).value

                        wb.sheets(5).cells(i, 37).value = wb.sheets(3).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value
                        wb.sheets(5).cells(i, 38).value = wb.sheets(2).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value
                        wb.sheets(5).cells(i, 39).value = wb.sheets(4).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value
                        wb.sheets(5).cells(i, 40).value = CargosMenosAbonos(1103) / wb.sheets(5).cells(1, 4).value
                        wb.sheets(5).cells(i, 41).value = CargosMenosAbonos(1104) / wb.sheets(5).cells(1, 4).value
                        wb.sheets(5).cells(i, 46).value = wb.sheets(1).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value

                        wb.sheets(5).cells(i, 50).value = TotalAbonos(1701) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                        wb.sheets(5).cells(i, 51).value = TotalAbonos(1702) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                        wb.sheets(5).cells(i, 52).value = TotalAbonos(1703) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                        wb.sheets(5).cells(i, 53).value = TotalAbonos(1704) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                        wb.sheets(5).cells(i, 54).value = TotalAbonos(1705) / (wb.sheets(5).cells(1, 3).value)
                        wb.sheets(5).cells(i, 55).value = TotalAbonos(1706) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                        wb.sheets(5).cells(i, 56).value = TotalAbonos(1707) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                        wb.sheets(5).cells(i, 57).value = TotalAbonos(1708) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                        wb.sheets(5).cells(i, 58).value = TotalAbonos(1709) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                        wb.sheets(5).cells(i, 63).value = TotalCargos(1710) / (wb.sheets(5).cells(1, 3).value)
                        wb.sheets(5).cells(i, 67).value = 0
                        SqlConnection.ClearAllPools()

                    Else
                        wb.sheets(5).cells(i, 15).value = 0
                        wb.sheets(5).cells(i, 16).value = 0

                        wb.sheets(5).cells(i, 37).value = 0
                        wb.sheets(5).cells(i, 38).value = 0
                        wb.sheets(5).cells(i, 39).value = 0
                        wb.sheets(5).cells(i, 40).value = 0
                        wb.sheets(5).cells(i, 41).value = 0
                        wb.sheets(5).cells(i, 46).value = 0

                        wb.sheets(5).cells(i, 50).value = 0
                        wb.sheets(5).cells(i, 51).value = 0
                        wb.sheets(5).cells(i, 52).value = 0
                        wb.sheets(5).cells(i, 53).value = 0
                        wb.sheets(5).cells(i, 54).value = 0
                        wb.sheets(5).cells(i, 55).value = 0
                        wb.sheets(5).cells(i, 56).value = 0
                        wb.sheets(5).cells(i, 57).value = 0
                        wb.sheets(5).cells(i, 58).value = 0
                        wb.sheets(5).cells(i, 63).value = 0
                        wb.sheets(5).cells(i, 67).value = 0
                    End If

                    wb.sheets(5).cells(i, 22).value = wb.sheets(5).cells(i, 21).value + (wb.sheets(5).cells(i, 21).value * wb.sheets(6).cells(29, 10).value)
                    wb.sheets(5).cells(i, 26).value = wb.sheets(5).cells(i, 25).value + (wb.sheets(5).cells(i, 25).value * wb.sheets(6).cells(29, 14).value)
                    wb.sheets(5).cells(i, 28).value = wb.sheets(5).cells(i, 27).value + (wb.sheets(5).cells(i, 27).value * wb.sheets(6).cells(29, 18).value)
                    wb.sheets(5).cells(i, 30).value = wb.sheets(5).cells(i, 29).value + (wb.sheets(5).cells(i, 29).value * wb.sheets(6).cells(29, 22).value)
                    wb.sheets(5).cells(i, 32).value = wb.sheets(5).cells(i, 31).value + (wb.sheets(5).cells(i, 31).value * wb.sheets(6).cells(29, 26).value)
                    wb.sheets(5).cells(i, 23).value = "=(" & CargosMenosAbonos(1101) & "/SUMAR.SI(F10:L1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",L10:L1000))*L" & i
                    wb.sheets(5).cells(i, 24).value = "=(" & CargosMenosAbonos(1102) & "/SUMAR.SI(F10:L1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ",L10:L1000))*L" & i

                    

                ElseIf wb.sheets(5).cells(i, 6).value = "LCB" Then
                    If wb.sheets(5).cells(i, 12).value > 0 Then
                        wb.sheets(5).cells(i, 15).value = AbonosMenosCargos(601) / wb.sheets(5).cells(6, 3).value
                        wb.sheets(5).cells(i, 16).value = AbonosMenosCargos(602) / wb.sheets(5).cells(6, 3).value

                        wb.sheets(5).cells(i, 37).value = (wb.sheets(3).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(3).cells(27, Columna).value / (wb.sheets(5).cells(6, 3).value))
                        wb.sheets(5).cells(i, 38).value = (wb.sheets(2).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(2).cells(27, Columna).value / (wb.sheets(5).cells(6, 3).value))
                        wb.sheets(5).cells(i, 39).value = (wb.sheets(4).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(4).cells(27, Columna).value / (wb.sheets(5).cells(6, 3).value))
                        wb.sheets(5).cells(i, 40).value = CargosMenosAbonos(1603) / wb.sheets(5).cells(6, 3).value
                        wb.sheets(5).cells(i, 41).value = CargosMenosAbonos(1604) / wb.sheets(5).cells(6, 3).value
                        wb.sheets(5).cells(i, 46).value = (wb.sheets(1).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(1).cells(27, Columna).value / (wb.sheets(5).cells(6, 3).value))

                        wb.sheets(5).cells(i, 50).value = TotalAbonos(3101) / (wb.sheets(5).cells(6, 3).value)
                        wb.sheets(5).cells(i, 51).value = TotalAbonos(3102) / (wb.sheets(5).cells(6, 3).value)
                        wb.sheets(5).cells(i, 52).value = TotalAbonos(3103) / (wb.sheets(5).cells(6, 3).value)
                        wb.sheets(5).cells(i, 53).value = TotalAbonos(3104) / (wb.sheets(5).cells(6, 3).value)
                        wb.sheets(5).cells(i, 54).value = TotalAbonos(3105) / (wb.sheets(5).cells(6, 3).value)
                        wb.sheets(5).cells(i, 55).value = TotalAbonos(3106) / (wb.sheets(5).cells(6, 3).value)
                        wb.sheets(5).cells(i, 56).value = TotalAbonos(3107) / (wb.sheets(5).cells(6, 3).value)
                        wb.sheets(5).cells(i, 57).value = TotalAbonos(3108) / (wb.sheets(5).cells(6, 3).value)
                        wb.sheets(5).cells(i, 58).value = TotalAbonos(3109) / (wb.sheets(5).cells(6, 3).value)
                        wb.sheets(5).cells(i, 63).value = TotalCargos(3110) / (wb.sheets(5).cells(6, 3).value)
                        wb.sheets(5).cells(i, 67).value = 0
                        SqlConnection.ClearAllPools()
                    Else
                        wb.sheets(5).cells(i, 15).value = 0
                        wb.sheets(5).cells(i, 16).value = 0

                        wb.sheets(5).cells(i, 37).value = 0
                        wb.sheets(5).cells(i, 38).value = 0
                        wb.sheets(5).cells(i, 39).value = 0
                        wb.sheets(5).cells(i, 40).value = 0
                        wb.sheets(5).cells(i, 41).value = 0
                        wb.sheets(5).cells(i, 46).value = 0

                        wb.sheets(5).cells(i, 50).value = 0
                        wb.sheets(5).cells(i, 51).value = 0
                        wb.sheets(5).cells(i, 52).value = 0
                        wb.sheets(5).cells(i, 53).value = 0
                        wb.sheets(5).cells(i, 54).value = 0
                        wb.sheets(5).cells(i, 55).value = 0
                        wb.sheets(5).cells(i, 56).value = 0
                        wb.sheets(5).cells(i, 57).value = 0
                        wb.sheets(5).cells(i, 58).value = 0
                        wb.sheets(5).cells(i, 63).value = 0
                        wb.sheets(5).cells(i, 67).value = 0
                    End If

                    wb.sheets(5).cells(i, 22).value = wb.sheets(5).cells(i, 21).value + (wb.sheets(5).cells(i, 21).value * wb.sheets(6).cells(34, 10).value)
                    wb.sheets(5).cells(i, 26).value = wb.sheets(5).cells(i, 25).value + (wb.sheets(5).cells(i, 25).value * wb.sheets(6).cells(34, 14).value)
                    wb.sheets(5).cells(i, 28).value = wb.sheets(5).cells(i, 27).value + (wb.sheets(5).cells(i, 27).value * wb.sheets(6).cells(34, 18).value)
                    wb.sheets(5).cells(i, 30).value = wb.sheets(5).cells(i, 29).value + (wb.sheets(5).cells(i, 29).value * wb.sheets(6).cells(34, 22).value)
                    wb.sheets(5).cells(i, 32).value = wb.sheets(5).cells(i, 31).value + (wb.sheets(5).cells(i, 31).value * wb.sheets(6).cells(34, 26).value)
                    wb.sheets(5).cells(i, 23).value = "=(" & CargosMenosAbonos(1601) & "/SUMAR.SI(F10:L1000," & Chr(34) & "LCB" & Chr(34) & ",L10:L1000))*L" & i
                    wb.sheets(5).cells(i, 24).value = "=(" & CargosMenosAbonos(1602) & "/SUMAR.SI(F10:L1000," & Chr(34) & "LCB" & Chr(34) & ",L10:L1000))*L" & i

                   

                ElseIf wb.sheets(5).cells(i, 6).value = "AUS/SECTOR SUBURBANO" Then
                    If wb.sheets(5).cells(i, 5).value = "Ruta 77" Then
                        If wb.sheets(5).cells(i, 12).value > 0 Then
                            wb.sheets(5).cells(i, 15).value = AbonosMenosCargos(101) / wb.sheets(5).cells(1, 3).value
                            wb.sheets(5).cells(i, 16).value = AbonosMenosCargos(102) / wb.sheets(5).cells(1, 3).value

                            wb.sheets(5).cells(i, 50).value = TotalAbonos(1701) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 51).value = TotalAbonos(1702) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 52).value = TotalAbonos(1703) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 53).value = TotalAbonos(1704) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 54).value = TotalAbonos(1705) / (wb.sheets(5).cells(1, 3).value)
                            wb.sheets(5).cells(i, 55).value = TotalAbonos(1706) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 56).value = TotalAbonos(1707) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 57).value = TotalAbonos(1708) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 58).value = TotalAbonos(1709) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 63).value = TotalCargos(1710) / (wb.sheets(5).cells(1, 3).value)
                            wb.sheets(5).cells(i, 67).value = 0
                            SqlConnection.ClearAllPools()
                        Else
                            wb.sheets(5).cells(i, 15).value = 0
                            wb.sheets(5).cells(i, 16).value = 0
                        End If
                    ElseIf wb.sheets(5).cells(i, 5).value = "Ruta 78" Then
                        If wb.sheets(5).cells(i, 12).value > 0 Then
                            wb.sheets(5).cells(i, 15).value = AbonosMenosCargos(101) / wb.sheets(5).cells(1, 3).value
                            wb.sheets(5).cells(i, 16).value = AbonosMenosCargos(102) / wb.sheets(5).cells(1, 3).value
                            SqlConnection.ClearAllPools()

                            wb.sheets(5).cells(i, 50).value = TotalAbonos(1701) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 51).value = TotalAbonos(1702) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 52).value = TotalAbonos(1703) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 53).value = TotalAbonos(1704) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 54).value = TotalAbonos(1705) / (wb.sheets(5).cells(1, 3).value)
                            wb.sheets(5).cells(i, 55).value = TotalAbonos(1706) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 56).value = TotalAbonos(1707) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 57).value = TotalAbonos(1708) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 58).value = TotalAbonos(1709) / (wb.sheets(5).cells(1, 3).value + wb.sheets(5).cells(2, 3).value)
                            wb.sheets(5).cells(i, 63).value = TotalCargos(1710) / (wb.sheets(5).cells(1, 3).value)
                            wb.sheets(5).cells(i, 67).value = 0
                        Else
                            wb.sheets(5).cells(i, 15).value = 0
                            wb.sheets(5).cells(i, 16).value = 0

                            wb.sheets(5).cells(i, 50).value = 0
                            wb.sheets(5).cells(i, 51).value = 0
                            wb.sheets(5).cells(i, 52).value = 0
                            wb.sheets(5).cells(i, 53).value = 0
                            wb.sheets(5).cells(i, 54).value = 0
                            wb.sheets(5).cells(i, 55).value = 0
                            wb.sheets(5).cells(i, 56).value = 0
                            wb.sheets(5).cells(i, 57).value = 0
                            wb.sheets(5).cells(i, 58).value = 0
                            wb.sheets(5).cells(i, 63).value = 0
                            wb.sheets(5).cells(i, 67).value = 0
                        End If
                    Else
                        wb.sheets(5).cells(i, 15).value = 0
                        wb.sheets(5).cells(i, 16).value = AbonosMenosCargos(202) / wb.sheets(5).cells(2, 3).value

                        wb.sheets(5).cells(i, 50).value = 0
                        wb.sheets(5).cells(i, 51).value = 0
                        wb.sheets(5).cells(i, 52).value = 0
                        wb.sheets(5).cells(i, 53).value = 0
                        wb.sheets(5).cells(i, 54).value = 0
                        wb.sheets(5).cells(i, 55).value = 0
                        wb.sheets(5).cells(i, 56).value = 0
                        wb.sheets(5).cells(i, 57).value = 0
                        wb.sheets(5).cells(i, 58).value = 0
                        wb.sheets(5).cells(i, 63).value = 0
                        wb.sheets(5).cells(i, 67).value = 0

                        SqlConnection.ClearAllPools()
                    End If

                    wb.sheets(5).cells(i, 22).value = wb.sheets(5).cells(i, 21).value + (wb.sheets(5).cells(i, 21).value * wb.sheets(6).cells(30, 10).value)
                    wb.sheets(5).cells(i, 26).value = wb.sheets(5).cells(i, 25).value + (wb.sheets(5).cells(i, 25).value * wb.sheets(6).cells(30, 14).value)
                    wb.sheets(5).cells(i, 28).value = wb.sheets(5).cells(i, 27).value + (wb.sheets(5).cells(i, 27).value * wb.sheets(6).cells(30, 18).value)
                    wb.sheets(5).cells(i, 30).value = wb.sheets(5).cells(i, 29).value + (wb.sheets(5).cells(i, 29).value * wb.sheets(6).cells(30, 22).value)
                    wb.sheets(5).cells(i, 32).value = wb.sheets(5).cells(i, 31).value + (wb.sheets(5).cells(i, 31).value * wb.sheets(6).cells(30, 26).value)
                    wb.sheets(5).cells(i, 23).value = "=(" & CargosMenosAbonos(1201) & "/SUMAR.SI(F10:L1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",L10:L1000))*L" & i
                    wb.sheets(5).cells(i, 24).value = "=(" & CargosMenosAbonos(1202) & "/SUMAR.SI(F10:L1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ",L10:L1000))*L" & i

                    If wb.sheets(5).cells(i, 12).value > 0 Then
                        wb.sheets(5).cells(i, 37).value = wb.sheets(3).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value
                        wb.sheets(5).cells(i, 38).value = wb.sheets(2).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value
                        wb.sheets(5).cells(i, 39).value = wb.sheets(4).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value
                        wb.sheets(5).cells(i, 40).value = CargosMenosAbonos(1203) / wb.sheets(5).cells(2, 4).value
                        wb.sheets(5).cells(i, 41).value = CargosMenosAbonos(1204) / wb.sheets(5).cells(2, 4).value
                        wb.sheets(5).cells(i, 46).value = wb.sheets(1).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value

                      
                    Else
                        wb.sheets(5).cells(i, 37).value = 0
                        wb.sheets(5).cells(i, 38).value = 0
                        wb.sheets(5).cells(i, 39).value = 0
                        wb.sheets(5).cells(i, 40).value = 0
                        wb.sheets(5).cells(i, 41).value = 0
                        wb.sheets(5).cells(i, 46).value = 0

                        wb.sheets(5).cells(i, 50).value = 0
                        wb.sheets(5).cells(i, 51).value = 0
                        wb.sheets(5).cells(i, 52).value = 0
                        wb.sheets(5).cells(i, 53).value = 0
                        wb.sheets(5).cells(i, 54).value = 0
                        wb.sheets(5).cells(i, 55).value = 0
                        wb.sheets(5).cells(i, 56).value = 0
                        wb.sheets(5).cells(i, 57).value = 0
                        wb.sheets(5).cells(i, 58).value = 0
                        wb.sheets(5).cells(i, 63).value = 0
                        wb.sheets(5).cells(i, 67).value = 0
                    End If

                   
                ElseIf wb.sheets(5).cells(i, 6).value = "ACG" Then
                    If wb.sheets(5).cells(i, 12).value > 0 Then
                        wb.sheets(5).cells(i, 15).value = 0
                        wb.sheets(5).cells(i, 16).value = AbonosMenosCargos(302) / wb.sheets(5).cells(3, 3).value

                        wb.sheets(5).cells(i, 37).value = (wb.sheets(3).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(3).cells(25, Columna).value / (wb.sheets(5).cells(3, 3).value + wb.sheets(5).cells(4, 3).value))
                        wb.sheets(5).cells(i, 38).value = (wb.sheets(2).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(2).cells(25, Columna).value / (wb.sheets(5).cells(3, 3).value + wb.sheets(5).cells(4, 3).value))
                        wb.sheets(5).cells(i, 39).value = (wb.sheets(4).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(4).cells(25, Columna).value / (wb.sheets(5).cells(3, 3).value + wb.sheets(5).cells(4, 3).value))
                        wb.sheets(5).cells(i, 40).value = CargosMenosAbonos(1303) / wb.sheets(5).cells(3, 3).value
                        wb.sheets(5).cells(i, 41).value = CargosMenosAbonos(1304) / wb.sheets(5).cells(3, 3).value
                        wb.sheets(5).cells(i, 46).value = (wb.sheets(1).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(1).cells(25, Columna).value / (wb.sheets(5).cells(3, 3).value + wb.sheets(5).cells(4, 3).value))

                        wb.sheets(5).cells(i, 50).value = TotalAbonos(1801) / (wb.sheets(5).cells(3, 3).value)
                        wb.sheets(5).cells(i, 51).value = TotalAbonos(1802) / (wb.sheets(5).cells(3, 3).value)
                        wb.sheets(5).cells(i, 52).value = TotalAbonos(1803) / (wb.sheets(5).cells(3, 3).value)
                        wb.sheets(5).cells(i, 53).value = TotalAbonos(1804) / (wb.sheets(5).cells(3, 3).value)
                        wb.sheets(5).cells(i, 54).value = 0
                        wb.sheets(5).cells(i, 55).value = TotalAbonos(1806) / (wb.sheets(5).cells(3, 3).value)
                        wb.sheets(5).cells(i, 56).value = TotalAbonos(1807) / (wb.sheets(5).cells(3, 3).value)
                        wb.sheets(5).cells(i, 57).value = TotalAbonos(1808) / (wb.sheets(5).cells(3, 3).value)
                        wb.sheets(5).cells(i, 58).value = TotalAbonos(1809) / (wb.sheets(5).cells(3, 3).value)
                        wb.sheets(5).cells(i, 63).value = TotalCargos(1810) / (wb.sheets(5).cells(3, 3).value)
                        wb.sheets(5).cells(i, 67).value = 0

                        SqlConnection.ClearAllPools()
                    Else
                        wb.sheets(5).cells(i, 15).value = 0
                        wb.sheets(5).cells(i, 16).value = 0

                        wb.sheets(5).cells(i, 37).value = 0
                        wb.sheets(5).cells(i, 38).value = 0
                        wb.sheets(5).cells(i, 39).value = 0
                        wb.sheets(5).cells(i, 40).value = 0
                        wb.sheets(5).cells(i, 41).value = 0
                        wb.sheets(5).cells(i, 46).value = 0

                        wb.sheets(5).cells(i, 50).value = 0
                        wb.sheets(5).cells(i, 51).value = 0
                        wb.sheets(5).cells(i, 52).value = 0
                        wb.sheets(5).cells(i, 53).value = 0
                        wb.sheets(5).cells(i, 54).value = 0
                        wb.sheets(5).cells(i, 55).value = 0
                        wb.sheets(5).cells(i, 56).value = 0
                        wb.sheets(5).cells(i, 57).value = 0
                        wb.sheets(5).cells(i, 58).value = 0
                        wb.sheets(5).cells(i, 63).value = 0
                        wb.sheets(5).cells(i, 67).value = 0

                    End If


                    wb.sheets(5).cells(i, 22).value = wb.sheets(5).cells(i, 21).value + (wb.sheets(5).cells(i, 21).value * wb.sheets(6).cells(31, 10).value)
                    wb.sheets(5).cells(i, 26).value = wb.sheets(5).cells(i, 25).value + (wb.sheets(5).cells(i, 25).value * wb.sheets(6).cells(31, 14).value)
                    wb.sheets(5).cells(i, 28).value = wb.sheets(5).cells(i, 27).value + (wb.sheets(5).cells(i, 27).value * wb.sheets(6).cells(31, 18).value)
                    wb.sheets(5).cells(i, 30).value = wb.sheets(5).cells(i, 29).value + (wb.sheets(5).cells(i, 29).value * wb.sheets(6).cells(31, 22).value)
                    wb.sheets(5).cells(i, 32).value = wb.sheets(5).cells(i, 31).value + (wb.sheets(5).cells(i, 31).value * wb.sheets(6).cells(31, 26).value)
                    wb.sheets(5).cells(i, 23).value = "=(" & CargosMenosAbonos(1301) & "/SUMAR.SI(F10:L1000," & Chr(34) & "ACG" & Chr(34) & ",L10:L1000))*L" & i
                    wb.sheets(5).cells(i, 24).value = "=(" & CargosMenosAbonos(1302) & "/SUMAR.SI(F10:L1000," & Chr(34) & "ACG" & Chr(34) & ",L10:L1000))*L" & i

                   
                ElseIf wb.sheets(5).cells(i, 6).value = "SPT" Then
                    If wb.sheets(5).cells(i, 12).value > 0 Then
                        wb.sheets(5).cells(i, 15).value = 0
                        wb.sheets(5).cells(i, 16).value = AbonosMenosCargos(402) / wb.sheets(5).cells(4, 3).value

                        wb.sheets(5).cells(i, 37).value = (wb.sheets(3).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(3).cells(25, Columna).value / (wb.sheets(5).cells(3, 3).value + wb.sheets(5).cells(4, 3).value))
                        wb.sheets(5).cells(i, 38).value = (wb.sheets(2).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(2).cells(25, Columna).value / (wb.sheets(5).cells(3, 3).value + wb.sheets(5).cells(4, 3).value))
                        wb.sheets(5).cells(i, 39).value = (wb.sheets(4).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(4).cells(25, Columna).value / (wb.sheets(5).cells(3, 3).value + wb.sheets(5).cells(4, 3).value))
                        wb.sheets(5).cells(i, 40).value = CargosMenosAbonos(1403) / wb.sheets(5).cells(4, 3).value
                        wb.sheets(5).cells(i, 41).value = CargosMenosAbonos(1404) / wb.sheets(5).cells(4, 3).value
                        wb.sheets(5).cells(i, 46).value = (wb.sheets(1).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(1).cells(25, Columna).value / (wb.sheets(5).cells(3, 3).value + wb.sheets(5).cells(4, 3).value))

                        wb.sheets(5).cells(i, 50).value = TotalAbonos(1901) / (wb.sheets(5).cells(4, 3).value)
                        wb.sheets(5).cells(i, 51).value = TotalAbonos(1902) / (wb.sheets(5).cells(4, 3).value)
                        wb.sheets(5).cells(i, 52).value = TotalAbonos(1903) / (wb.sheets(5).cells(4, 3).value)
                        wb.sheets(5).cells(i, 53).value = TotalAbonos(1904) / (wb.sheets(5).cells(4, 3).value)
                        wb.sheets(5).cells(i, 54).value = 0
                        wb.sheets(5).cells(i, 55).value = TotalAbonos(1906) / (wb.sheets(5).cells(4, 3).value)
                        wb.sheets(5).cells(i, 56).value = TotalAbonos(1907) / (wb.sheets(5).cells(4, 3).value)
                        wb.sheets(5).cells(i, 57).value = TotalAbonos(1908) / (wb.sheets(5).cells(4, 3).value)
                        wb.sheets(5).cells(i, 58).value = TotalAbonos(1909) / (wb.sheets(5).cells(4, 3).value)
                        wb.sheets(5).cells(i, 63).value = TotalCargos(1910) / (wb.sheets(5).cells(4, 3).value)
                        wb.sheets(5).cells(i, 67).value = 0
                        SqlConnection.ClearAllPools()
                    Else
                       
                        wb.sheets(5).cells(i, 15).value = 0
                        wb.sheets(5).cells(i, 16).value = 0

                        wb.sheets(5).cells(i, 37).value = 0
                        wb.sheets(5).cells(i, 38).value = 0
                        wb.sheets(5).cells(i, 39).value = 0
                        wb.sheets(5).cells(i, 40).value = 0
                        wb.sheets(5).cells(i, 41).value = 0
                        wb.sheets(5).cells(i, 46).value = 0

                        wb.sheets(5).cells(i, 50).value = 0
                        wb.sheets(5).cells(i, 51).value = 0
                        wb.sheets(5).cells(i, 52).value = 0
                        wb.sheets(5).cells(i, 53).value = 0
                        wb.sheets(5).cells(i, 54).value = 0
                        wb.sheets(5).cells(i, 55).value = 0
                        wb.sheets(5).cells(i, 56).value = 0
                        wb.sheets(5).cells(i, 57).value = 0
                        wb.sheets(5).cells(i, 58).value = 0
                        wb.sheets(5).cells(i, 63).value = 0
                        wb.sheets(5).cells(i, 67).value = 0

                    End If

                    wb.sheets(5).cells(i, 22).value = wb.sheets(5).cells(i, 21).value + (wb.sheets(5).cells(i, 21).value * wb.sheets(6).cells(32, 10).value)
                    wb.sheets(5).cells(i, 26).value = wb.sheets(5).cells(i, 25).value + (wb.sheets(5).cells(i, 25).value * wb.sheets(6).cells(32, 14).value)
                    wb.sheets(5).cells(i, 28).value = wb.sheets(5).cells(i, 27).value + (wb.sheets(5).cells(i, 27).value * wb.sheets(6).cells(32, 18).value)
                    wb.sheets(5).cells(i, 30).value = wb.sheets(5).cells(i, 29).value + (wb.sheets(5).cells(i, 29).value * wb.sheets(6).cells(32, 22).value)
                    wb.sheets(5).cells(i, 32).value = wb.sheets(5).cells(i, 31).value + (wb.sheets(5).cells(i, 31).value * wb.sheets(6).cells(32, 26).value)
                    wb.sheets(5).cells(i, 23).value = "=(" & CargosMenosAbonos(1401) & "/SUMAR.SI(F10:L1000," & Chr(34) & "SPT" & Chr(34) & ",L10:L1000))*L" & i
                    wb.sheets(5).cells(i, 24).value = "=(" & CargosMenosAbonos(1402) & "/SUMAR.SI(F10:L1000," & Chr(34) & "SPT" & Chr(34) & ",L10:L1000))*L" & i

                    

                ElseIf wb.sheets(5).cells(i, 6).value = "ASP" Then
                    If wb.sheets(5).cells(i, 12).value > 0 Then
                        wb.sheets(5).cells(i, 15).value = 0
                        wb.sheets(5).cells(i, 16).value = AbonosMenosCargos(502) / wb.sheets(5).cells(5, 3).value

                        wb.sheets(5).cells(i, 37).value = (wb.sheets(3).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(3).cells(26, Columna).value / (wb.sheets(5).cells(5, 3).value))
                        wb.sheets(5).cells(i, 38).value = (wb.sheets(2).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(2).cells(26, Columna).value / (wb.sheets(5).cells(5, 3).value))
                        wb.sheets(5).cells(i, 39).value = (wb.sheets(4).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(4).cells(26, Columna).value / (wb.sheets(5).cells(5, 3).value))
                        wb.sheets(5).cells(i, 40).value = CargosMenosAbonos(1503) / wb.sheets(5).cells(5, 3).value
                        wb.sheets(5).cells(i, 41).value = CargosMenosAbonos(1504) / wb.sheets(5).cells(5, 3).value
                        wb.sheets(5).cells(i, 46).value = (wb.sheets(1).cells(31, Columna).value / wb.sheets(5).cells(7, 3).value) + (wb.sheets(1).cells(26, Columna).value / (wb.sheets(5).cells(5, 3).value))

                        wb.sheets(5).cells(i, 50).value = TotalAbonos(2001) / (wb.sheets(5).cells(5, 3).value)
                        wb.sheets(5).cells(i, 51).value = TotalAbonos(2002) / (wb.sheets(5).cells(5, 3).value)
                        wb.sheets(5).cells(i, 52).value = TotalAbonos(2003) / (wb.sheets(5).cells(5, 3).value)
                        wb.sheets(5).cells(i, 53).value = TotalAbonos(2004) / (wb.sheets(5).cells(5, 3).value)
                        wb.sheets(5).cells(i, 54).value = 0
                        wb.sheets(5).cells(i, 55).value = TotalAbonos(2006) / (wb.sheets(5).cells(5, 3).value)
                        wb.sheets(5).cells(i, 56).value = TotalAbonos(2007) / (wb.sheets(5).cells(5, 3).value)
                        wb.sheets(5).cells(i, 57).value = TotalAbonos(2008) / (wb.sheets(5).cells(5, 3).value)
                        wb.sheets(5).cells(i, 58).value = TotalAbonos(2009) / (wb.sheets(5).cells(5, 3).value)
                        wb.sheets(5).cells(i, 63).value = TotalCargos(2010) / (wb.sheets(5).cells(5, 3).value)
                        wb.sheets(5).cells(i, 67).value = 0
                        SqlConnection.ClearAllPools()
                    Else
                        wb.sheets(5).cells(i, 15).value = 0
                        wb.sheets(5).cells(i, 16).value = 0

                        wb.sheets(5).cells(i, 37).value = 0
                        wb.sheets(5).cells(i, 38).value = 0
                        wb.sheets(5).cells(i, 39).value = 0
                        wb.sheets(5).cells(i, 40).value = 0
                        wb.sheets(5).cells(i, 41).value = 0
                        wb.sheets(5).cells(i, 46).value = 0

                        wb.sheets(5).cells(i, 50).value = 0
                        wb.sheets(5).cells(i, 51).value = 0
                        wb.sheets(5).cells(i, 52).value = 0
                        wb.sheets(5).cells(i, 53).value = 0
                        wb.sheets(5).cells(i, 54).value = 0
                        wb.sheets(5).cells(i, 55).value = 0
                        wb.sheets(5).cells(i, 56).value = 0
                        wb.sheets(5).cells(i, 57).value = 0
                        wb.sheets(5).cells(i, 58).value = 0
                        wb.sheets(5).cells(i, 63).value = 0
                        wb.sheets(5).cells(i, 67).value = 0
                    End If
                   
                    wb.sheets(5).cells(i, 22).value = wb.sheets(5).cells(i, 21).value + (wb.sheets(5).cells(i, 21).value * wb.sheets(6).cells(33, 10).value)
                    wb.sheets(5).cells(i, 26).value = wb.sheets(5).cells(i, 25).value + (wb.sheets(5).cells(i, 25).value * wb.sheets(6).cells(33, 14).value)
                    wb.sheets(5).cells(i, 28).value = wb.sheets(5).cells(i, 27).value + (wb.sheets(5).cells(i, 27).value * wb.sheets(6).cells(33, 18).value)
                    wb.sheets(5).cells(i, 30).value = wb.sheets(5).cells(i, 29).value + (wb.sheets(5).cells(i, 29).value * wb.sheets(6).cells(33, 22).value)
                    wb.sheets(5).cells(i, 32).value = wb.sheets(5).cells(i, 31).value + (wb.sheets(5).cells(i, 31).value * wb.sheets(6).cells(33, 26).value)
                    wb.sheets(5).cells(i, 23).value = "=(" & CargosMenosAbonos(1501) & "/SUMAR.SI(F10:L1000," & Chr(34) & "ASP" & Chr(34) & ",L10:L1000))*L" & i
                    wb.sheets(5).cells(i, 24).value = "=(" & CargosMenosAbonos(1502) & "/SUMAR.SI(F10:L1000," & Chr(34) & "ASP" & Chr(34) & ",L10:L1000))*L" & i

                    

                End If
            End If

        Next
       
    End Sub
    Sub Ajustes()
        wb = xl.activeworkbook
        ' xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count)) 'ESTA SE VA A QUITAR
        wb.SHEETS(6).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(6).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(6).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(6).cells(2, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(6).cells(2, 2).FONT.SIZE = 14
        wb.SHEETS(6).cells(3, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(6).cells(3, 2).FONT.SIZE = 12
        wb.SHEETS(6).cells(4, 2).value = "AJUSTES VARIOS"

        wb.SHEETS(6).cells(6, 2).value = "Rutas"
        wb.SHEETS(6).cells(6, 3).value = "Pagobus"
        wb.SHEETS(6).cells(6, 7).value = "Diesel"
        wb.SHEETS(6).cells(6, 11).value = "Refacciones"
        wb.SHEETS(6).cells(6, 15).value = "Reparaciones"
        wb.SHEETS(6).cells(6, 19).value = "Llantas Nuevas"
        wb.SHEETS(6).cells(6, 23).value = "Llantas Vitalizadas"
        wb.SHEETS(6).cells(6, 27).value = "Otros Ingresos"

        AjustaRangoCelda(6, "B6:B7")
        AjustaRangoCelda(6, "C6:F6")
        AjustaRangoCelda(6, "G6:J6")
        AjustaRangoCelda(6, "K6:N6")
        AjustaRangoCelda(6, "O6:R6")
        AjustaRangoCelda(6, "S6:V6")
        AjustaRangoCelda(6, "W6:Z6")
        AjustaRangoCelda(6, "AA6:AD6")

        wb.SHEETS(6).cells(7, 3).value = "RPA"
        wb.SHEETS(6).cells(7, 4).value = "Contabilidad"
        wb.SHEETS(6).cells(7, 5).value = "Diferencia"
        wb.SHEETS(6).cells(7, 6).value = "Factor"
        wb.SHEETS(6).cells(7, 7).value = "RPA"
        wb.SHEETS(6).cells(7, 8).value = "Contabilidad"
        wb.SHEETS(6).cells(7, 9).value = "Diferencia"
        wb.SHEETS(6).cells(7, 10).value = "Factor"
        wb.SHEETS(6).cells(7, 11).value = "RPA"
        wb.SHEETS(6).cells(7, 12).value = "Contabilidad"
        wb.SHEETS(6).cells(7, 13).value = "Diferencia"
        wb.SHEETS(6).cells(7, 14).value = "Factor"
        wb.SHEETS(6).cells(7, 15).value = "RPA"
        wb.SHEETS(6).cells(7, 16).value = "Contabilidad"
        wb.SHEETS(6).cells(7, 17).value = "Diferencia"
        wb.SHEETS(6).cells(7, 18).value = "Factor"
        wb.SHEETS(6).cells(7, 19).value = "RPA"
        wb.SHEETS(6).cells(7, 20).value = "Contabilidad"
        wb.SHEETS(6).cells(7, 21).value = "Diferencia"
        wb.SHEETS(6).cells(7, 22).value = "Factor"
        wb.SHEETS(6).cells(7, 23).value = "RPA"
        wb.SHEETS(6).cells(7, 24).value = "Contabilidad"
        wb.SHEETS(6).cells(7, 25).value = "Diferencia"
        wb.SHEETS(6).cells(7, 26).value = "Factor"
        wb.SHEETS(6).cells(7, 27).value = "RPA"
        wb.SHEETS(6).cells(7, 28).value = "Contabilidad"
        wb.SHEETS(6).cells(7, 29).value = "Diferencia"
        wb.SHEETS(6).cells(7, 30).value = "Factor"

        wb.SHEETS(6).Range("C7:AD7").INTERIOR.ThemeColor = 1
        wb.SHEETS(6).Range("C7:AD7").INTERIOR.TintAndShade = -0.0499893185216834

        wb.SHEETS(6).columns(2).columnwidth = 32
        wb.SHEETS(6).columns(3).columnwidth = 12
        wb.SHEETS(6).columns(4).columnwidth = 12
        wb.SHEETS(6).columns(5).columnwidth = 12
        wb.SHEETS(6).columns(6).columnwidth = 12
        wb.SHEETS(6).columns(7).columnwidth = 12
        wb.SHEETS(6).columns(8).columnwidth = 12
        wb.SHEETS(6).columns(9).columnwidth = 12
        wb.SHEETS(6).columns(10).columnwidth = 12
        wb.SHEETS(6).columns(11).columnwidth = 12
        wb.SHEETS(6).columns(12).columnwidth = 12
        wb.SHEETS(6).columns(13).columnwidth = 12
        wb.SHEETS(6).columns(14).columnwidth = 12
        wb.SHEETS(6).columns(15).columnwidth = 12
        wb.SHEETS(6).columns(16).columnwidth = 12
        wb.SHEETS(6).columns(17).columnwidth = 12
        wb.SHEETS(6).columns(18).columnwidth = 12
        wb.SHEETS(6).columns(19).columnwidth = 12
        wb.SHEETS(6).columns(20).columnwidth = 12
        wb.SHEETS(6).columns(21).columnwidth = 12
        wb.SHEETS(6).columns(22).columnwidth = 12
        wb.SHEETS(6).columns(23).columnwidth = 12
        wb.SHEETS(6).columns(24).columnwidth = 12
        wb.SHEETS(6).columns(25).columnwidth = 12
        wb.SHEETS(6).columns(26).columnwidth = 12
        wb.SHEETS(6).columns(27).columnwidth = 12
        wb.SHEETS(6).columns(28).columnwidth = 12
        wb.SHEETS(6).columns(29).columnwidth = 12
        wb.SHEETS(6).columns(30).columnwidth = 12
        wb.SHEETS(6).columns(31).columnwidth = 12
        wb.SHEETS(6).columns(32).columnwidth = 12

        For i = 3 To 30
            wb.SHEETS(6).cells(6, i).font.bold = True
            wb.SHEETS(6).cells(7, i).font.bold = True

            wb.SHEETS(6).CELLS(7, i).HorizontalAlignment = -4108
            wb.SHEETS(6).CELLS(7, i).VerticalAlignment = -4108
            wb.SHEETS(6).CELLS(7, i).WrapText = True
            wb.SHEETS(6).CELLS(7, i).Orientation = 0
            wb.SHEETS(6).CELLS(7, i).AddIndent = False
            wb.SHEETS(6).CELLS(7, i).IndentLevel = 0
            wb.SHEETS(6).CELLS(7, i).ShrinkToFit = False
            wb.SHEETS(6).CELLS(7, i).MergeCells = False
            wb.SHEETS(6).CELLS(7, i).ReadingOrder = -5002

        Next

        For i = 3 To 30
            wb.SHEETS(6).columns(i).NumberFormat = "#,##0.00"
        Next

        Dim Rng As Integer = 28
        Dim VALOR As Integer = 7
        Dim PrimerRenglon As Integer = 0

        wb.SHEETS(6).cells(Rng, 3).value = "=SUMA(C8:C27)"
        wb.SHEETS(6).cells(Rng, 4).value = "=SUMA(D8:D27)"
        wb.SHEETS(6).cells(Rng, 5).value = "=SUMA(E8:E27)"
        wb.SHEETS(6).cells(Rng, 6).value = "=SUMA(F8:F27)"
        wb.SHEETS(6).cells(Rng, 7).value = "=SUMA(G8:G27)"
        wb.SHEETS(6).cells(Rng, 8).value = "=SUMA(H8:H27)"
        wb.SHEETS(6).cells(Rng, 9).value = "=SUMA(I8:I27)"
        wb.SHEETS(6).cells(Rng, 10).value = "=SUMA(J8:J27)"
        wb.SHEETS(6).cells(Rng, 11).value = "=SUMA(K8:K27)"
        wb.SHEETS(6).cells(Rng, 12).value = "=SUMA(L8:L27)"
        wb.SHEETS(6).cells(Rng, 13).value = "=SUMA(M8:M27)"
        wb.SHEETS(6).cells(Rng, 14).value = "=SUMA(N8:N27)"
        wb.SHEETS(6).cells(Rng, 15).value = "=SUMA(O8:O27)"
        wb.SHEETS(6).cells(Rng, 16).value = "=SUMA(P8:P27)"
        wb.SHEETS(6).cells(Rng, 17).value = "=SUMA(Q8:Q27)"
        wb.SHEETS(6).cells(Rng, 18).value = "=SUMA(R8:R27)"
        wb.SHEETS(6).cells(Rng, 19).value = "=SUMA(S8:S27)"
        wb.SHEETS(6).cells(Rng, 20).value = "=SUMA(T8:T27)"
        wb.SHEETS(6).cells(Rng, 21).value = "=SUMA(U8:U27)"
        wb.SHEETS(6).cells(Rng, 22).value = "=SUMA(V8:V27)"
        wb.SHEETS(6).cells(Rng, 23).value = "=SUMA(W8:W27)"
        wb.SHEETS(6).cells(Rng, 24).value = "=SUMA(X8:X27)"
        wb.SHEETS(6).cells(Rng, 25).value = "=SUMA(Y8:Y27)"
        wb.SHEETS(6).cells(Rng, 26).value = "=SUMA(Z8:Z27)"
        wb.SHEETS(6).cells(Rng, 27).value = "=SUMA(AA8:AA27)"
        wb.SHEETS(6).cells(Rng, 28).value = "=SUMA(AB8:AB27)"
        wb.SHEETS(6).cells(Rng, 29).value = "=SUMA(AC8:AC27)"
        wb.SHEETS(6).cells(Rng, 30).value = "=SUMA(AD8:AD27)"

        Rng = 35

        wb.SHEETS(6).cells(Rng, 3).value = "=SUMA(C29:C34)"
        wb.SHEETS(6).cells(Rng, 4).value = "=SUMA(D29:D34)"
        wb.SHEETS(6).cells(Rng, 5).value = "=SUMA(E29:E34)"
        wb.SHEETS(6).cells(Rng, 6).value = "=SUMA(F29:F34)"
        wb.SHEETS(6).cells(Rng, 7).value = "=SUMA(G29:G34)"
        wb.SHEETS(6).cells(Rng, 8).value = "=SUMA(H29:H34)"
        wb.SHEETS(6).cells(Rng, 9).value = "=SUMA(I29:I34)"
        wb.SHEETS(6).cells(Rng, 10).value = "=SUMA(J29:J34)"
        wb.SHEETS(6).cells(Rng, 11).value = "=SUMA(K29:K34)"
        wb.SHEETS(6).cells(Rng, 12).value = "=SUMA(L29:L34)"
        wb.SHEETS(6).cells(Rng, 13).value = "=SUMA(M29:M34)"
        wb.SHEETS(6).cells(Rng, 14).value = "=SUMA(N29:N34)"
        wb.SHEETS(6).cells(Rng, 15).value = "=SUMA(O29:O34)"
        wb.SHEETS(6).cells(Rng, 16).value = "=SUMA(P29:P34)"
        wb.SHEETS(6).cells(Rng, 17).value = "=SUMA(Q29:Q34)"
        wb.SHEETS(6).cells(Rng, 18).value = "=SUMA(R29:R34)"
        wb.SHEETS(6).cells(Rng, 19).value = "=SUMA(S29:S34)"
        wb.SHEETS(6).cells(Rng, 20).value = "=SUMA(T29:T34)"
        wb.SHEETS(6).cells(Rng, 21).value = "=SUMA(U29:U34)"
        wb.SHEETS(6).cells(Rng, 22).value = "=SUMA(V29:V34)"
        wb.SHEETS(6).cells(Rng, 23).value = "=SUMA(W29:W34)"
        wb.SHEETS(6).cells(Rng, 24).value = "=SUMA(X29:X34)"
        wb.SHEETS(6).cells(Rng, 25).value = "=SUMA(Y29:Y34)"
        wb.SHEETS(6).cells(Rng, 26).value = "=SUMA(Z29:Z34)"
        wb.SHEETS(6).cells(Rng, 27).value = "=SUMA(AA29:AA34)"
        wb.SHEETS(6).cells(Rng, 28).value = "=SUMA(AB29:AB34)"
        wb.SHEETS(6).cells(Rng, 29).value = "=SUMA(AC29:AC34)"
        wb.SHEETS(6).cells(Rng, 30).value = "=SUMA(AD29:AD34)"

        wb.SHEETS(6).cells(8, 2).value = "Ruta 15 Auxiliar"
        wb.SHEETS(6).cells(9, 2).value = "Ruta 73 Auxiliar"
        wb.SHEETS(6).cells(10, 2).value = "Ruta 9 Auxiliar"
        wb.SHEETS(6).cells(11, 2).value = "Ruta 35 Alimentadora"
        wb.SHEETS(6).cells(12, 2).value = "Ruta 66 Alimentadora"
        wb.SHEETS(6).cells(13, 2).value = "Ruta 16 Alimentadora"
        wb.SHEETS(6).cells(14, 2).value = "Ruta 77"
        wb.SHEETS(6).cells(15, 2).value = "Ruta 78"
        wb.SHEETS(6).cells(16, 2).value = "Ruta 1"
        wb.SHEETS(6).cells(17, 2).value = "Ruta 1 Autxiliar"
        wb.SHEETS(6).cells(18, 2).value = "Ruta 11 Auxiliar"
        wb.SHEETS(6).cells(19, 2).value = "Ruta 16"
        wb.SHEETS(6).cells(20, 2).value = "Ruta 17"
        wb.SHEETS(6).cells(21, 2).value = "Ruta 3"
        wb.SHEETS(6).cells(22, 2).value = "Ruta 53 Alimentadora"
        wb.SHEETS(6).cells(23, 2).value = "Ruta 55"
        wb.SHEETS(6).cells(24, 2).value = "Ruta 86"
        wb.SHEETS(6).cells(25, 2).value = "Centrales de Guanajuato"
        wb.SHEETS(6).cells(26, 2).value = "Pasaje Terrestre"
        wb.SHEETS(6).cells(27, 2).value = "Azules y Triangulo"

        wb.SHEETS(6).cells(29, 2).value = "AUS/SECTOR URBANO"
        wb.SHEETS(6).cells(30, 2).value = "AUS/SECTOR SUBURBANO"
        wb.SHEETS(6).cells(31, 2).value = "ACG"
        wb.SHEETS(6).cells(32, 2).value = "SPT"
        wb.SHEETS(6).cells(33, 2).value = "ASP"
        wb.SHEETS(6).cells(34, 2).value = "LCB"


        wb.SHEETS(6).name = "Ajustes"
        For i = 8 To 27
            If wb.SHEETS(6).cells(i, 2).value <> "" Then
                wb.SHEETS(6).cells(i, 3).value = "=SI(ESERROR(SUMAR.SI(RPA!$E$10:$M$1000,Ajustes!$B" & i & ",RPA!$M$10:$M$1000)),0,SUMAR.SI(RPA!$E$10:$M$1000,Ajustes!$B" & i & ",RPA!$M$10:$M$1000))"
                wb.SHEETS(6).cells(i, 5).value = "=C" & i & "-D" & i
                wb.SHEETS(6).cells(i, 6).value = "=SI(ESERROR((E" & i & "/C" & i & ")),0,(E" & i & "/C" & i & "))"
                For j = 7 To 30
                    wb.SHEETS(6).cells(i, j).value = 0
                Next
            End If
        Next

        For i = 29 To 34
            wb.SHEETS(6).cells(i, 7).value = "=SI(ESERROR(SUMAR.SI(RPA!$F$10:$U$1000,Ajustes!$B" & i & ",RPA!$U$10:$U$1000)),0,SUMAR.SI(RPA!$F$10:$U$1000,Ajustes!$B" & i & ",RPA!$U$10:$U$1000))"
            wb.SHEETS(6).cells(i, 11).value = "=SI(ESERROR(SUMAR.SI(RPA!$F$10:$Y$1000,Ajustes!$B" & i & ",RPA!$Y$10:$Y$1000)),0,SUMAR.SI(RPA!$F$10:$Y$1000,Ajustes!$B" & i & ",RPA!$Y$10:$Y$1000))"
            wb.SHEETS(6).cells(i, 15).value = "=SI(ESERROR(SUMAR.SI(RPA!$F$10:$AA$1000,Ajustes!$B" & i & ",RPA!$AA$10:$AA$1000)),0,SUMAR.SI(RPA!$F$10:$AA$1000,Ajustes!$B" & i & ",RPA!$AA$10:$AA$1000))"
            wb.SHEETS(6).cells(i, 19).value = "=SI(ESERROR(SUMAR.SI(RPA!$F$10:$AC$1000,Ajustes!$B" & i & ",RPA!$AC$10:$AC$1000)),0,SUMAR.SI(RPA!$F$10:$AC$1000,Ajustes!$B" & i & ",RPA!$AC$10:$AC$1000))"
            wb.SHEETS(6).cells(i, 23).value = "=SI(ESERROR(SUMAR.SI(RPA!$F$10:$AE$1000,Ajustes!$B" & i & ",RPA!$AE$10:$AE$1000)),0,SUMAR.SI(RPA!$F$10:$AE$1000,Ajustes!$B" & i & ",RPA!$AE$10:$AE$1000))"

            wb.SHEETS(6).cells(i, 10).value = "=SI(ESERROR(SI(I" & i & "<>0,I" & i & "/G" & i & ",0)),0,SI(I" & i & "<>0,I" & i & "/G" & i & ",0))"
            wb.SHEETS(6).cells(i, 14).value = "=SI(ESERROR(SI(M" & i & "<>0,M" & i & "/K" & i & ",0)),0,SI(M" & i & "<>0,M" & i & "/K" & i & ",0))"
            wb.SHEETS(6).cells(i, 18).value = "=SI(ESERROR(SI(Q" & i & "<>0,Q" & i & "/O" & i & ",0)),0,SI(Q" & i & "<>0,Q" & i & "/O" & i & ",0))"
            wb.SHEETS(6).cells(i, 22).value = "=SI(ESERROR(SI(U" & i & "<>0,U" & i & "/S" & i & ",0)),0,SI(U" & i & "<>0,U" & i & "/S" & i & ",0))"
            wb.SHEETS(6).cells(i, 26).value = "=SI(ESERROR(SI(Y" & i & "<>0,Y" & i & "/W" & i & ",0)),0,SI(Y" & i & "<>0,Y" & i & "/W" & i & ",0))"

            wb.SHEETS(6).cells(i, 9).value = "=H" & i & "-G" & i
            wb.SHEETS(6).cells(i, 13).value = "=L" & i & "-K" & i
            wb.SHEETS(6).cells(i, 17).value = "=P" & i & "-O" & i
            wb.SHEETS(6).cells(i, 21).value = "=T" & i & "-S" & i
            wb.SHEETS(6).cells(i, 25).value = "=X" & i & "-W" & i
        Next

        wb.SHEETS(6).cells(8, 4).value = AbonosMenosCargos(10)
        wb.SHEETS(6).cells(9, 4).value = AbonosMenosCargos(19)
        wb.SHEETS(6).cells(10, 4).value = AbonosMenosCargos(11)
        wb.SHEETS(6).cells(11, 4).value = AbonosMenosCargos(12)
        wb.SHEETS(6).cells(12, 4).value = AbonosMenosCargos(13)
        wb.SHEETS(6).cells(13, 4).value = AbonosMenosCargos(18)
        wb.SHEETS(6).cells(14, 4).value = AbonosMenosCargos(16)
        wb.SHEETS(6).cells(15, 4).value = AbonosMenosCargos(17)
        wb.SHEETS(6).cells(16, 4).value = AbonosMenosCargos(20)
        wb.SHEETS(6).cells(17, 4).value = AbonosMenosCargos(27)
        wb.SHEETS(6).cells(18, 4).value = AbonosMenosCargos(28)
        wb.SHEETS(6).cells(19, 4).value = AbonosMenosCargos(22)
        wb.SHEETS(6).cells(20, 4).value = AbonosMenosCargos(23)
        wb.SHEETS(6).cells(21, 4).value = AbonosMenosCargos(21)
        wb.SHEETS(6).cells(22, 4).value = AbonosMenosCargos(26)
        wb.SHEETS(6).cells(23, 4).value = AbonosMenosCargos(24)
        wb.SHEETS(6).cells(24, 4).value = AbonosMenosCargos(25)
        wb.SHEETS(6).cells(25, 4).value = 0
        wb.SHEETS(6).cells(26, 4).value = 0
        wb.SHEETS(6).cells(27, 4).value = 0

        wb.SHEETS(6).cells(29, 8).value = CargosMenosAbonos(5001) * 1.16
        wb.SHEETS(6).cells(30, 8).value = CargosMenosAbonos(5002) * 1.16
        wb.SHEETS(6).cells(31, 8).value = CargosMenosAbonos(5003) * 1.16
        wb.SHEETS(6).cells(32, 8).value = CargosMenosAbonos(5004) * 1.16
        wb.SHEETS(6).cells(33, 8).value = CargosMenosAbonos(5005) * 1.16
        wb.SHEETS(6).cells(34, 8).value = CargosMenosAbonos(5006) * 1.16

        wb.SHEETS(6).cells(29, 12).value = CargosMenosAbonos(5101) * 1.16
        wb.SHEETS(6).cells(30, 12).value = CargosMenosAbonos(5102) * 1.16
        wb.SHEETS(6).cells(31, 12).value = CargosMenosAbonos(5103) * 1.16
        wb.SHEETS(6).cells(32, 12).value = CargosMenosAbonos(5104) * 1.16
        wb.SHEETS(6).cells(33, 12).value = CargosMenosAbonos(5105) * 1.16
        wb.SHEETS(6).cells(34, 12).value = CargosMenosAbonos(5106) * 1.16

        wb.SHEETS(6).cells(29, 16).value = CargosMenosAbonos(5201) * 1.16
        wb.SHEETS(6).cells(30, 16).value = CargosMenosAbonos(5202) * 1.16
        wb.SHEETS(6).cells(31, 16).value = CargosMenosAbonos(5203) * 1.16
        wb.SHEETS(6).cells(32, 16).value = CargosMenosAbonos(5204) * 1.16
        wb.SHEETS(6).cells(33, 16).value = CargosMenosAbonos(5205) * 1.16
        wb.SHEETS(6).cells(34, 16).value = CargosMenosAbonos(5206) * 1.16

        wb.SHEETS(6).cells(29, 20).value = CargosMenosAbonos(5301) * 1.16
        wb.SHEETS(6).cells(30, 20).value = CargosMenosAbonos(5302) * 1.16
        wb.SHEETS(6).cells(31, 20).value = CargosMenosAbonos(5303) * 1.16
        wb.SHEETS(6).cells(32, 20).value = CargosMenosAbonos(5304) * 1.16
        wb.SHEETS(6).cells(33, 20).value = CargosMenosAbonos(5305) * 1.16
        wb.SHEETS(6).cells(34, 20).value = CargosMenosAbonos(5306) * 1.16

        wb.SHEETS(6).cells(29, 24).value = CargosMenosAbonos(5401) * 1.16
        wb.SHEETS(6).cells(30, 24).value = CargosMenosAbonos(5402) * 1.16
        wb.SHEETS(6).cells(31, 24).value = CargosMenosAbonos(5403) * 1.16
        wb.SHEETS(6).cells(32, 24).value = CargosMenosAbonos(5404) * 1.16
        wb.SHEETS(6).cells(33, 24).value = CargosMenosAbonos(5405) * 1.16
        wb.SHEETS(6).cells(34, 24).value = CargosMenosAbonos(5406) * 1.16


    End Sub
    Sub ResultadoPorAutobus()
        Dim cnconn As New SqlConnection
        Dim cmdBuscar As New SqlCommand
        Dim cmdAsignar As New SqlCommand
        Dim rdBuscar As SqlDataReader

        cnconn.ConnectionString = CitraConnection
        cnconn.Open()
        cmdBuscar.Connection = cnconn
        cmdAsignar.Connection = cnconn

        Dim strSql As String = ""
        strSql = "SELECT CCODIGOC01,CRAZONSO01,C.CIDVALOR01,V.CVALORCL01,C.CIDVALOR05 FROM MGW10002 C INNER JOIN MGW10020 V ON C.CIDVALOR02=V.CIDVALOR01 WHERE CTIPOCLI01=1 AND CESTATUS=1 AND C.CIMPORTE04>0 AND CCODIGOC01 LIKE '%U%' ORDER BY C.CIMPORTE04,C.CIDVALOR05,C.CIDVALOR01,CRAZONSO01"

        cmdBuscar.CommandText = strSql
        rdBuscar = cmdBuscar.ExecuteReader

        wb = xl.activeworkbook
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        wb.SHEETS(5).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(5).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(5).CELLS.FONT.size = 10

        wb.SHEETS(5).cells(1, 2).value = "Buses AUS/SECTOR URBANO"
        wb.SHEETS(5).cells(2, 2).value = "Buses AUS/SECTOR SUBURBANO"
        wb.SHEETS(5).cells(3, 2).value = "Buses ACG"
        wb.SHEETS(5).cells(4, 2).value = "Buses SPT"
        wb.SHEETS(5).cells(5, 2).value = "Buses ASP"
        wb.SHEETS(5).cells(6, 2).value = "Buses LCB"
        wb.SHEETS(5).cells(7, 2).value = "Total Autobuses"

        wb.SHEETS(5).cells(1, 5).value = "=CONTAR.SI(F10:F1000," & Chr(34) & "AUS/SECTOR URBANO" & Chr(34) & ")"
        wb.SHEETS(5).cells(2, 5).value = "=CONTAR.SI(F10:F1000," & Chr(34) & "AUS/SECTOR SUBURBANO" & Chr(34) & ")"
        wb.SHEETS(5).cells(3, 5).value = "=CONTAR.SI(F10:F1000," & Chr(34) & "ACG" & Chr(34) & ")"
        wb.SHEETS(5).cells(4, 5).value = "=CONTAR.SI(F10:F1000," & Chr(34) & "SPT" & Chr(34) & ")"
        wb.SHEETS(5).cells(5, 5).value = "=CONTAR.SI(F10:F1000," & Chr(34) & "ASP" & Chr(34) & ")"
        wb.SHEETS(5).cells(6, 5).value = "=CONTAR.SI(F10:F1000," & Chr(34) & "LCB" & Chr(34) & ")"
        wb.SHEETS(5).cells(7, 5).value = "=SUMA(E1:E6)"

        wb.SHEETS(5).cells(8, 9).value = "Precio Diesel"
        wb.SHEETS(5).cells(8, 10).value = 0
        wb.SHEETS(5).cells(8, 12).value = "VENTAS"
        wb.SHEETS(5).cells(8, 21).value = "COSTOS DIRECTOS"
        wb.SHEETS(5).cells(8, 37).value = "COSTOS INDIRECTOS DE OPERACIÓN"
        wb.SHEETS(5).cells(8, 46).value = "COSTOS INDIRECTOS DE ADMINISTRACIÓN"
        wb.SHEETS(5).cells(8, 50).value = "RESERVAS"


        AjustaRangoCelda(5, "L8:S8")
        AjustaRangoCelda(5, "U8:AG8")
        AjustaRangoCelda(5, "AK8:AP8")
        AjustaRangoCelda(5, "AT8:AT8")
        AjustaRangoCelda(5, "AX8:BG8")

        wb.SHEETS(5).Range("B9:J9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("B9:J9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("L9:S9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("L9:S9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("U9:AG9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("U9:AG9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("AI9:AI9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("AI9:AI9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("AK9:AP9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("AK9:AP9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("AR9:AR9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("AR9:AR9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("AT9:AT9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("AT9:AT9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("AV9:AV9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("AV9:AV9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("AX9:BG9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("AX9:BG9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("BI9:BI9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("BI9:BI9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("BK9:BK9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("BK9:BK9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("BM9:BM9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("BM9:BM9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("BO9:BO9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("BO9:BO9").INTERIOR.TintAndShade = -0.0499893185216834
        wb.SHEETS(5).Range("BQ9:BQ9").INTERIOR.ThemeColor = 1
        wb.SHEETS(5).Range("BQ9:BQ9").INTERIOR.TintAndShade = -0.0499893185216834

       



        wb.SHEETS(5).cells(9, 2).value = "Empresa"
        wb.SHEETS(5).cells(9, 3).value = "No. Interno"
        wb.SHEETS(5).cells(9, 4).value = "No. Economico"
        wb.SHEETS(5).cells(9, 5).value = "Ruta"
        wb.SHEETS(5).cells(9, 6).value = "Sector"
        wb.SHEETS(5).cells(9, 7).value = "Kilometros Recorridos"
        wb.SHEETS(5).cells(9, 8).value = "Ingreso ($) por Km. Recorrido"
        wb.SHEETS(5).cells(9, 9).value = "Diesel ($) por Km. Recorrido"
        wb.SHEETS(5).cells(9, 10).value = "Kilometros por Diesel Consumido"
        wb.SHEETS(5).cells(9, 12).value = "Ingresos Boletos de Abordo"
        wb.SHEETS(5).cells(9, 13).value = "Ingresos Pagobus (Antes Ajuste)"
        wb.SHEETS(5).cells(9, 14).value = "Ingresos Pagobus"
        wb.SHEETS(5).cells(9, 15).value = "Ingresos Red Integral Optibus"
        wb.SHEETS(5).cells(9, 16).value = "Otros Ingresos (Antes Ajuste)"
        wb.SHEETS(5).cells(9, 17).value = "Otros Ingresos"
        wb.SHEETS(5).cells(9, 18).value = "Servicios Especiales"
        wb.SHEETS(5).cells(9, 19).value = "Total de Ingresos"

        wb.SHEETS(5).cells(9, 21).value = "Diesel (Antes de Ajuste)"
        wb.SHEETS(5).cells(9, 22).value = "Diesel"
        wb.SHEETS(5).cells(9, 23).value = "Sueldos y Salarios"
        wb.SHEETS(5).cells(9, 24).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(5).cells(9, 25).value = "Refacciones (Antes de Ajuste)"
        wb.SHEETS(5).cells(9, 26).value = "Refacciones"
        wb.SHEETS(5).cells(9, 27).value = "Mantenimiento y Reparacion de Autobuses (Antes de Ajuste)"
        wb.SHEETS(5).cells(9, 28).value = "Mantenimiento y Reparacion de Autobuses"
        wb.SHEETS(5).cells(9, 29).value = "Llantas Nuevas (Antes de ajuste)"
        wb.SHEETS(5).cells(9, 30).value = "Llantas Nuevas"
        wb.SHEETS(5).cells(9, 31).value = "Llantas Vitalizadas (Antes de Ajuste)"
        wb.SHEETS(5).cells(9, 32).value = "Llantas Vitalizadas"
        wb.SHEETS(5).cells(9, 33).value = "Total de Costos Directos"

        wb.SHEETS(5).cells(9, 35).value = "UTILIDAD BRUTA"

        wb.SHEETS(5).cells(9, 37).value = "Gastos de Mantenimiento"
        wb.SHEETS(5).cells(9, 38).value = "Gastos de Operacion y Servicios"
        wb.SHEETS(5).cells(9, 39).value = "Gastos de Seguro Interno"
        wb.SHEETS(5).cells(9, 40).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(5).cells(9, 41).value = "Gastos Diversos de Operacion"
        wb.SHEETS(5).cells(9, 42).value = "Total de Costos Indirectos"

        wb.SHEETS(5).cells(9, 44).value = "UTILIDAD MARGINAL"

        wb.SHEETS(5).cells(9, 46).value = "Gastos de Administracion"

        wb.SHEETS(5).cells(9, 48).value = "UTILIDAD ANTES DE RESERVAS"

        wb.SHEETS(5).cells(9, 50).value = "Reserva para Aguinaldo"
        wb.SHEETS(5).cells(9, 51).value = "Reserva para Tenencias y Refrendos"
        wb.SHEETS(5).cells(9, 52).value = "Reserva para Prima de Seguros"
        wb.SHEETS(5).cells(9, 53).value = "Fondo Para Renovacion de Equipo"
        wb.SHEETS(5).cells(9, 54).value = "Aportaciones al Fideicomiso"
        wb.SHEETS(5).cells(9, 55).value = "Reserva para capacitacion, adiestramiento, seguridad e higiene y otros"
        wb.SHEETS(5).cells(9, 56).value = "Reserva para PTU"
        wb.SHEETS(5).cells(9, 57).value = "Reserva para uniformes y otros gastos mayores"
        wb.SHEETS(5).cells(9, 58).value = "Reserva para adquisicion de activos"
        wb.SHEETS(5).cells(9, 59).value = "Total de Reservas"

        wb.SHEETS(5).cells(9, 61).value = "RESULTADO ANTES DE DOCUMENTOS"

        wb.SHEETS(5).cells(9, 63).value = "Documento de Unidades"

        wb.SHEETS(5).cells(9, 65).value = "RESULTADO ANTES DE IMPUESTOS"

        wb.SHEETS(5).cells(9, 67).value = "Impuesto Sobre la Renta"

        wb.SHEETS(5).cells(9, 69).value = "RESULTADO NETO"


        Dim Rng As Integer = 9

        For i = 2 To 69
            wb.SHEETS(5).CELLS(Rng, i).HorizontalAlignment = -4108
            wb.SHEETS(5).CELLS(Rng, i).VerticalAlignment = -4108
            wb.SHEETS(5).CELLS(Rng, i).WrapText = True
            wb.SHEETS(5).CELLS(Rng, i).Orientation = 0
            wb.SHEETS(5).CELLS(Rng, i).AddIndent = False
            wb.SHEETS(5).CELLS(Rng, i).IndentLevel = 0
            wb.SHEETS(5).CELLS(Rng, i).ShrinkToFit = False
            wb.SHEETS(5).CELLS(Rng, i).MergeCells = False
            wb.SHEETS(5).CELLS(Rng, i).ReadingOrder = -5002
        Next

        Rng = Rng + 1

        Dim Empresa As String = "?"
        Rng = 7

        Dim UltimoRegistro As Integer
        Dim RngInicial As Integer = Rng + 3

        Dim ColG As String = ""
        Dim colL As String = ""
        Dim ColM As String = ""
        Dim ColN As String = ""
        Dim ColO As String = ""
        Dim ColP As String = ""
        Dim ColQ As String = ""
        Dim ColR As String = ""
        Dim ColS As String = ""

        Dim ColU As String = ""
        Dim ColV As String = ""
        Dim ColW As String = ""
        Dim ColX As String = ""
        Dim ColY As String = ""
        Dim ColZ As String = ""
        Dim ColAA As String = ""
        Dim ColAB As String = ""
        Dim ColAC As String = ""
        Dim ColAD As String = ""
        Dim ColAE As String = ""
        Dim ColAF As String = ""
        Dim ColAG As String = ""
        Dim ColAI As String = ""
        Dim ColAK As String = ""
        Dim ColAL As String = ""
        Dim ColAM As String = ""
        Dim ColAN As String = ""
        Dim ColAO As String = ""
        Dim ColAP As String = ""
        Dim ColAR As String = ""
        Dim ColAT As String = ""
        Dim ColAV As String = ""
        Dim ColAX As String = ""
        Dim ColAY As String = ""
        Dim ColAZ As String = ""
        Dim ColBA As String = ""
        Dim ColBB As String = ""
        Dim ColBC As String = ""
        Dim ColBE As String = ""
        Dim ColBD As String = ""
        Dim ColBF As String = ""
        Dim ColBG As String = ""
        Dim ColBI As String = ""
        Dim ColBK As String = ""
        Dim ColBM As String = ""
        Dim ColBO As String = ""
        Dim ColBQ As String = ""

        Dim Primero As Boolean = True

        Do While rdBuscar.Read()
            If Empresa <> rdBuscar("cValorCL01").ToString.Trim Then
                If Primero = False Then
                    wb.SHEETS(5).cells(Rng, 5).value = "Total"
                    wb.SHEETS(5).cells(Rng + 1, 5).value = "Autobuses"
                    wb.SHEETS(5).cells(Rng + 1, 5).font.bold = True
                    wb.SHEETS(5).cells(Rng, 7).value = "=SUMA(G" & RngInicial & ":G" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 12).value = "=SUMA(L" & RngInicial & ":L" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 13).value = "=SUMA(M" & RngInicial & ":M" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 14).value = "=SUMA(N" & RngInicial & ":N" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 15).value = "=SUMA(O" & RngInicial & ":O" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 16).value = "=SUMA(P" & RngInicial & ":P" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 17).value = "=SUMA(Q" & RngInicial & ":Q" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 18).value = "=SUMA(R" & RngInicial & ":R" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 19).value = "=SUMA(S" & RngInicial & ":S" & Rng - 1 & ")"

                    wb.SHEETS(5).cells(Rng, 21).value = "=SUMA(U" & RngInicial & ":U" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 22).value = "=SUMA(V" & RngInicial & ":V" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 23).value = "=SUMA(W" & RngInicial & ":W" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 24).value = "=SUMA(X" & RngInicial & ":X" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 25).value = "=SUMA(Y" & RngInicial & ":Y" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 26).value = "=SUMA(Z" & RngInicial & ":Z" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 27).value = "=SUMA(AA" & RngInicial & ":AA" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 28).value = "=SUMA(AB" & RngInicial & ":AB" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 29).value = "=SUMA(AC" & RngInicial & ":AC" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 30).value = "=SUMA(AD" & RngInicial & ":AD" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 31).value = "=SUMA(AE" & RngInicial & ":AE" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 32).value = "=SUMA(AF" & RngInicial & ":AF" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 33).value = "=SUMA(AG" & RngInicial & ":AG" & Rng - 1 & ")"

                    wb.SHEETS(5).cells(Rng, 35).value = "=SUMA(AI" & RngInicial & ":AI" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 37).value = "=SUMA(AK" & RngInicial & ":AK" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 38).value = "=SUMA(AL" & RngInicial & ":AL" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 39).value = "=SUMA(AM" & RngInicial & ":AM" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 40).value = "=SUMA(AN" & RngInicial & ":AN" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 41).value = "=SUMA(AO" & RngInicial & ":AO" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 42).value = "=SUMA(AP" & RngInicial & ":AP" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 44).value = "=SUMA(AR" & RngInicial & ":AR" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 46).value = "=SUMA(AT" & RngInicial & ":AT" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 48).value = "=SUMA(AV" & RngInicial & ":AV" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 50).value = "=SUMA(AX" & RngInicial & ":AX" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 51).value = "=SUMA(AY" & RngInicial & ":AY" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 52).value = "=SUMA(AZ" & RngInicial & ":AZ" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 53).value = "=SUMA(BA" & RngInicial & ":BA" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 54).value = "=SUMA(BB" & RngInicial & ":BB" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 55).value = "=SUMA(BC" & RngInicial & ":BC" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 56).value = "=SUMA(BD" & RngInicial & ":BD" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 57).value = "=SUMA(BE" & RngInicial & ":BE" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 58).value = "=SUMA(BF" & RngInicial & ":BF" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 59).value = "=SUMA(BG" & RngInicial & ":BG" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 61).value = "=SUMA(BI" & RngInicial & ":BI" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 63).value = "=SUMA(BK" & RngInicial & ":BK" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 65).value = "=SUMA(BM" & RngInicial & ":BM" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 67).value = "=SUMA(BO" & RngInicial & ":BO" & Rng - 1 & ")"
                    wb.SHEETS(5).cells(Rng, 69).value = "=SUMA(BQ" & RngInicial & ":BQ" & Rng - 1 & ")"

                    For i = 5 To 69
                        wb.SHEETS(5).cells(Rng, i).font.bold = True
                    Next

                    ColG = ColG & "+G" & Rng
                    colL = colL & "+L" & Rng
                    ColM = ColM & "+M" & Rng
                    ColN = ColN & "+N" & Rng
                    ColO = ColO & "+O" & Rng
                    ColP = ColP & "+P" & Rng
                    ColQ = ColQ & "+Q" & Rng
                    ColR = ColR & "+R" & Rng
                    ColS = ColS & "+S" & Rng

                    ColU = ColU & "+U" & Rng
                    ColV = ColV & "+V" & Rng
                    ColW = ColW & "+W" & Rng
                    ColX = ColX & "+X" & Rng
                    ColY = ColY & "+Y" & Rng
                    ColZ = ColZ & "+Z" & Rng
                    ColAA = ColAA & "+AA" & Rng
                    ColAB = ColAB & "+AB" & Rng
                    ColAC = ColAC & "+AC" & Rng
                    ColAD = ColAD & "+AD" & Rng
                    ColAE = ColAE & "+AE" & Rng
                    ColAF = ColAF & "+AF" & Rng
                    ColAG = ColAG & "+AG" & Rng

                    ColAI = ColAI & "+AI" & Rng
                    ColAK = ColAK & "+AK" & Rng
                    ColAL = ColAL & "+AL" & Rng
                    ColAM = ColAM & "+AM" & Rng
                    ColAN = ColAN & "+AN" & Rng
                    ColAO = ColAO & "+AO" & Rng
                    ColAP = ColAP & "+AP" & Rng
                    ColAR = ColAR & "+AR" & Rng
                    ColAT = ColAT & "+AT" & Rng
                    ColAV = ColAV & "+AV" & Rng
                    ColAX = ColAX & "+AX" & Rng
                    ColAY = ColAY & "+AY" & Rng
                    ColAZ = ColAZ & "+AZ" & Rng
                    ColBA = ColBA & "+BA" & Rng
                    ColBB = ColBB & "+BB" & Rng
                    ColBC = ColBC & "+BC" & Rng
                    ColBD = ColBD & "+BF" & Rng
                    ColBE = ColBE & "+BE" & Rng
                    ColBF = ColBF & "+BF" & Rng
                    ColBG = ColBG & "+BG" & Rng
                    ColBI = ColBI & "+BI" & Rng
                    ColBK = ColBK & "+BK" & Rng
                    ColBM = ColBM & "+BM" & Rng
                    ColBO = ColBO & "+BO" & Rng
                    ColBQ = ColBQ & "+BQ" & Rng

                    Rng = Rng + 3
                    RngInicial = Rng
                Else
                    Rng = Rng + 3
                    RngInicial = Rng
                End If
                Primero = False
            End If

            Empresa = rdBuscar("cValorCL01").ToString.Trim
            wb.SHEETS(5).cells(Rng, 2).value = Empresa
            wb.SHEETS(5).cells(Rng, 3).value = rdBuscar("cCodigoC01").ToString.Trim
            wb.SHEETS(5).cells(Rng, 4).value = rdBuscar("crazonso01").ToString.Trim
            wb.SHEETS(5).cells(Rng, 5).value = BuscarStrDatoCitra("SELECT CVALORCL01 FROM MGW10020 WHERE CIDVALOR01=" & rdBuscar("CIDVALOR01")).Trim
            wb.SHEETS(5).cells(Rng, 6).value = BuscarStrDatoCitra("SELECT CVALORCL01 FROM MGW10020 WHERE CIDVALOR01=" & rdBuscar("CIDVALOR05")).Trim
            Rng = Rng + 1
        Loop

        wb.SHEETS(5).cells(Rng, 5).value = "Total"
        wb.SHEETS(5).cells(Rng + 1, 5).value = "Autobuses"
        wb.SHEETS(5).cells(Rng + 1, 5).font.bold = True
        wb.SHEETS(5).cells(Rng, 7).value = "=SUMA(G" & RngInicial & ":G" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 12).value = "=SUMA(L" & RngInicial & ":L" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 13).value = "=SUMA(M" & RngInicial & ":M" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 14).value = "=SUMA(N" & RngInicial & ":N" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 15).value = "=SUMA(O" & RngInicial & ":O" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 16).value = "=SUMA(P" & RngInicial & ":P" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 17).value = "=SUMA(Q" & RngInicial & ":Q" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 18).value = "=SUMA(R" & RngInicial & ":R" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 19).value = "=SUMA(S" & RngInicial & ":S" & Rng - 1 & ")"

        wb.SHEETS(5).cells(Rng, 21).value = "=SUMA(U" & RngInicial & ":U" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 22).value = "=SUMA(V" & RngInicial & ":V" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 23).value = "=SUMA(W" & RngInicial & ":W" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 24).value = "=SUMA(X" & RngInicial & ":X" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 25).value = "=SUMA(Y" & RngInicial & ":Y" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 26).value = "=SUMA(Z" & RngInicial & ":Z" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 27).value = "=SUMA(AA" & RngInicial & ":AA" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 28).value = "=SUMA(AB" & RngInicial & ":AB" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 29).value = "=SUMA(AC" & RngInicial & ":AC" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 30).value = "=SUMA(AD" & RngInicial & ":AD" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 31).value = "=SUMA(AE" & RngInicial & ":AE" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 32).value = "=SUMA(AF" & RngInicial & ":AF" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 33).value = "=SUMA(AG" & RngInicial & ":AG" & Rng - 1 & ")"

        wb.SHEETS(5).cells(Rng, 35).value = "=SUMA(AI" & RngInicial & ":AI" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 37).value = "=SUMA(AK" & RngInicial & ":AK" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 38).value = "=SUMA(AL" & RngInicial & ":AL" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 39).value = "=SUMA(AM" & RngInicial & ":AM" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 40).value = "=SUMA(AN" & RngInicial & ":AN" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 41).value = "=SUMA(AO" & RngInicial & ":AO" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 42).value = "=SUMA(AP" & RngInicial & ":AP" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 44).value = "=SUMA(AR" & RngInicial & ":AR" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 46).value = "=SUMA(AT" & RngInicial & ":AT" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 48).value = "=SUMA(AV" & RngInicial & ":AV" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 50).value = "=SUMA(AX" & RngInicial & ":AX" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 51).value = "=SUMA(AY" & RngInicial & ":AY" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 52).value = "=SUMA(AZ" & RngInicial & ":AZ" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 53).value = "=SUMA(BA" & RngInicial & ":BA" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 54).value = "=SUMA(BB" & RngInicial & ":BB" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 55).value = "=SUMA(BC" & RngInicial & ":BC" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 56).value = "=SUMA(BD" & RngInicial & ":BD" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 57).value = "=SUMA(BE" & RngInicial & ":BE" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 58).value = "=SUMA(BF" & RngInicial & ":BF" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 59).value = "=SUMA(BG" & RngInicial & ":BG" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 61).value = "=SUMA(BI" & RngInicial & ":BI" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 63).value = "=SUMA(BK" & RngInicial & ":BK" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 65).value = "=SUMA(BM" & RngInicial & ":BM" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 67).value = "=SUMA(BO" & RngInicial & ":BO" & Rng - 1 & ")"
        wb.SHEETS(5).cells(Rng, 69).value = "=SUMA(BQ" & RngInicial & ":BQ" & Rng - 1 & ")"

        For i = 5 To 69
            wb.SHEETS(5).cells(Rng, i).font.bold = True
        Next

        ColG = ColG & "+G" & Rng
        colL = colL & "+L" & Rng
        ColM = ColM & "+M" & Rng
        ColN = ColN & "+N" & Rng
        ColO = ColO & "+O" & Rng
        ColP = ColP & "+P" & Rng
        ColQ = ColQ & "+Q" & Rng
        ColR = ColR & "+R" & Rng
        ColS = ColS & "+S" & Rng

        ColU = ColU & "+U" & Rng
        ColV = ColV & "+V" & Rng
        ColW = ColW & "+W" & Rng
        ColX = ColX & "+X" & Rng
        ColY = ColY & "+Y" & Rng
        ColZ = ColU & "+Z" & Rng
        ColAA = ColU & "+AA" & Rng
        ColAB = ColU & "+AB" & Rng
        ColAC = ColU & "+AC" & Rng
        ColAD = ColU & "+AD" & Rng
        ColAE = ColU & "+AE" & Rng
        ColAF = ColU & "+AF" & Rng
        ColAG = ColU & "+AG" & Rng

        ColAI = ColAI & "+AI" & Rng
        ColAK = ColAK & "+AK" & Rng
        ColAL = ColAL & "+AL" & Rng
        ColAM = ColAM & "+AM" & Rng
        ColAN = ColAN & "+AN" & Rng
        ColAO = ColAO & "+AO" & Rng
        ColAP = ColAP & "+AP" & Rng
        ColAR = ColAR & "+AR" & Rng
        ColAT = ColAT & "+AT" & Rng
        ColAV = ColAV & "+AV" & Rng
        ColAX = ColAX & "+AX" & Rng
        ColAY = ColAY & "+AY" & Rng
        ColAZ = ColAZ & "+AZ" & Rng
        ColBA = ColBA & "+BA" & Rng
        ColBB = ColBB & "+BB" & Rng
        ColBC = ColBC & "+BC" & Rng
        ColBD = ColBD & "+BF" & Rng
        ColBE = ColBE & "+BE" & Rng
        ColBF = ColBF & "+BF" & Rng
        ColBG = ColBG & "+BG" & Rng
        ColBI = ColBI & "+BI" & Rng
        ColBK = ColBK & "+BK" & Rng
        ColBM = ColBM & "+BM" & Rng
        ColBO = ColBO & "+BO" & Rng
        ColBQ = ColBQ & "+BQ" & Rng


        UltimoRegistro = Rng - 1

        Rng = Rng + 3
        wb.SHEETS(5).cells(Rng, 5).value = "Total Gral"
        wb.SHEETS(5).cells(Rng + 1, 5).value = "Autobuses"
        wb.SHEETS(5).cells(Rng + 1, 5).font.bold = True
        wb.SHEETS(5).cells(Rng + 1, 5).font.size = 11

        wb.SHEETS(5).cells(Rng, 7).value = "=" & ColG
        wb.SHEETS(5).cells(Rng, 12).value = "=" & colL
        wb.SHEETS(5).cells(Rng, 13).value = "=" & ColM
        wb.SHEETS(5).cells(Rng, 14).value = "=" & ColN
        wb.SHEETS(5).cells(Rng, 15).value = "=" & ColO
        wb.SHEETS(5).cells(Rng, 16).value = "=" & ColP
        wb.SHEETS(5).cells(Rng, 17).value = "=" & ColQ
        wb.SHEETS(5).cells(Rng, 18).value = "=" & ColR
        wb.SHEETS(5).cells(Rng, 19).value = "=" & ColS

        wb.SHEETS(5).cells(Rng, 21).value = "=" & ColU
        wb.SHEETS(5).cells(Rng, 22).value = "=" & ColV
        wb.SHEETS(5).cells(Rng, 23).value = "=" & ColW
        wb.SHEETS(5).cells(Rng, 24).value = "=" & ColX
        wb.SHEETS(5).cells(Rng, 25).value = "=" & ColY
        wb.SHEETS(5).cells(Rng, 26).value = "=" & ColZ
        wb.SHEETS(5).cells(Rng, 27).value = "=" & ColAA
        wb.SHEETS(5).cells(Rng, 28).value = "=" & ColAB
        wb.SHEETS(5).cells(Rng, 29).value = "=" & ColAC
        wb.SHEETS(5).cells(Rng, 30).value = "=" & ColAD
        wb.SHEETS(5).cells(Rng, 31).value = "=" & ColAE
        wb.SHEETS(5).cells(Rng, 32).value = "=" & ColAF
        wb.SHEETS(5).cells(Rng, 33).value = "=" & ColAG

        wb.SHEETS(5).cells(Rng, 35).value = "=" & ColAI
        wb.SHEETS(5).cells(Rng, 37).value = "=" & ColAK
        wb.SHEETS(5).cells(Rng, 38).value = "=" & ColAL
        wb.SHEETS(5).cells(Rng, 39).value = "=" & ColAM
        wb.SHEETS(5).cells(Rng, 40).value = "=" & ColAN
        wb.SHEETS(5).cells(Rng, 41).value = "=" & ColAO
        wb.SHEETS(5).cells(Rng, 42).value = "=" & ColAP
        wb.SHEETS(5).cells(Rng, 44).value = "=" & ColAR
        wb.SHEETS(5).cells(Rng, 46).value = "=" & ColAT
        wb.SHEETS(5).cells(Rng, 48).value = "=" & ColAV
        wb.SHEETS(5).cells(Rng, 50).value = "=" & ColAX
        wb.SHEETS(5).cells(Rng, 51).value = "=" & ColAY
        wb.SHEETS(5).cells(Rng, 52).value = "=" & ColAZ
        wb.SHEETS(5).cells(Rng, 53).value = "=" & ColBA
        wb.SHEETS(5).cells(Rng, 54).value = "=" & ColBB
        wb.SHEETS(5).cells(Rng, 55).value = "=" & ColBC
        wb.SHEETS(5).cells(Rng, 56).value = "=" & ColBD
        wb.SHEETS(5).cells(Rng, 57).value = "=" & ColBE
        wb.SHEETS(5).cells(Rng, 58).value = "=" & ColBF
        wb.SHEETS(5).cells(Rng, 59).value = "=" & ColBG
        wb.SHEETS(5).cells(Rng, 61).value = "=" & ColBI
        wb.SHEETS(5).cells(Rng, 63).value = "=" & ColBK
        wb.SHEETS(5).cells(Rng, 65).value = "=" & ColBM
        wb.SHEETS(5).cells(Rng, 67).value = "=" & ColBO
        wb.SHEETS(5).cells(Rng, 69).value = "=" & ColBQ

        For i = 5 To 69
            wb.SHEETS(5).cells(Rng, i).font.bold = True
            wb.SHEETS(5).cells(Rng, i).font.size = 11
        Next

        Dim Mes As String = lstMeses.Text
        Dim IntMes As Integer = 0
        Select Case Mes
            Case "Enero"
                IntMes = 1
            Case "Febrero"
                IntMes = 2
            Case "Marzo"
                IntMes = 3
            Case "Abril"
                IntMes = 4
            Case "Mayo"
                IntMes = 5
            Case "Junio"
                IntMes = 6
            Case "Julio"
                IntMes = 7
            Case "Agosto"
                IntMes = 8
            Case "Septiembre"
                IntMes = 9
            Case "Octubre"
                IntMes = 10
            Case "Noviembre"
                IntMes = 11
            Case "Diciembre"
                IntMes = 12
        End Select

        Dim Ingreso As Double = 0
        Dim BusesAUS As Integer = 0
        Dim BusesAUU As Integer = 0
        Dim BusesACG As Integer = 0
        Dim BusesSPT As Integer = 0
        Dim BusesASP As Integer = 0
        Dim BusesLCB As Integer = 0
        Dim Sector As String = ""

        For i = 10 To UltimoRegistro
            If wb.SHEETS(5).cells(i, 3).value <> "" Then
                wb.SHEETS(5).cells(i, 7).value = BuscarDblDatoCitra("SELECT SUM(KilometrosTotales) AS Total FROM Diesel D INNER JOIN Autobuses A ON D.IdAutobus=A.IdAutobus WHERE A.cCodigoC01='" & wb.SHEETS(5).cells(i, 3).value & "' AND YEAR(D.Fecha)=" & txtEjercicio.Text & " AND MONTH(D.Fecha)=" & IntMes)
                wb.sheets(5).cells(i, 8).value = "=S" & i & "/G" & i
                wb.sheets(5).cells(i, 9).value = "=SI(ESERROR(U" & i & "/G" & i & "),0,U" & i & "/G" & i & ")"
                wb.sheets(5).cells(i, 10).value = "=SI(ESERROR((V" & i & "/J8)/G" & i & "),0,(V" & i & "/J8)/G" & i & ")"

                Ingreso = BuscarDblDatoCitra("SELECT SUM(Liquidacion) AS Total FROM Liquidacion D INNER JOIN Autobuses A ON D.IdAutobus=A.IdAutobus WHERE A.cCodigoC01='" & wb.SHEETS(5).cells(i, 3).value & "' AND YEAR(D.Fecha)=" & txtEjercicio.Text & " AND MONTH(D.Fecha)=" & IntMes)
                wb.SHEETS(5).cells(i, 12).value = Ingreso
                If Ingreso > 0 Then
                    Sector = wb.sheets(5).cells(i, 6).value
                    If Sector = "AUS/SECTOR SUBURBANO" Then
                        BusesAUS = BusesAUS + 1
                    ElseIf Sector = "AUS/SECTOR URBANO" Then
                        BusesAUU = BusesAUU + 1
                    ElseIf Sector = "ACG" Then
                        BusesACG = BusesACG + 1
                    ElseIf Sector = "SPT" Then
                        BusesSPT = BusesSPT + 1
                    ElseIf Sector = "ASP" Then
                        BusesASP = BusesASP + 1
                    ElseIf Sector = "LCB" Then
                        BusesLCB = BusesLCB + 1
                    End If
                End If
                wb.SHEETS(5).cells(i, 13).value = BuscarDblDatoCitra("SELECT SUM(IngresoGeneral+IngresoPreferencial) AS Total FROM Pagobus D INNER JOIN Autobuses A ON D.IdAutobus=A.IdAutobus WHERE A.cCodigoC01='" & wb.SHEETS(5).cells(i, 3).value & "' AND YEAR(D.Fecha)=" & txtEjercicio.Text & " AND MONTH(D.Fecha)=" & IntMes)
                wb.SHEETS(5).cells(i, 17).value = "=P" & i
                wb.SHEETS(5).cells(i, 18).value = BuscarDblDatoCitra("SELECT SUM(Total) AS TOTAL FROM CuboIngresos WHERE Tipo='Servicios Especiales' AND NoInterno='" & wb.SHEETS(5).cells(i, 3).value & "' AND Anio=" & txtEjercicio.Text & " AND Mes=" & IntMes)
                wb.SHEETS(5).cells(i, 19).value = "=L" & i & "+N" & i & "+O" & i & "+Q" & i & "+R" & i

                wb.SHEETS(5).cells(i, 21).value = BuscarDblDatoCitra("SELECT SUM(Total) AS TOTAL FROM Diesel D INNER JOIN Autobuses A ON D.IdAutobus=A.IdAutobus WHERE A.cCodigoC01='" & wb.SHEETS(5).cells(i, 3).value & "' AND YEAR(D.Fecha)=" & txtEjercicio.Text & " AND MONTH(D.Fecha)=" & IntMes)
                wb.SHEETS(5).cells(i, 25).value = BuscarDblDatoCitra("SELECT SUM(cTotal) AS TOTAL FROM MGW10008 D INNER JOIN MGW10002 A ON D.cIdClien01=A.cIdClien01 INNER JOIN MGW10006 C ON D.cIdConce01=C.cIdConce01 WHERE A.cCodigoC01='" & wb.SHEETS(5).cells(i, 3).value & "' AND YEAR(D.cFecha)=" & txtEjercicio.Text & " AND MONTH(D.cFecha)=" & IntMes & " AND C.cNombreC01='Abastecimiento de refacciones'")
                wb.SHEETS(5).cells(i, 27).value = BuscarDblDatoCitra("SELECT SUM(cTotal) AS TOTAL FROM MGW10008 D INNER JOIN MGW10002 A ON D.cIdClien01=A.cIdClien01 INNER JOIN MGW10006 C ON D.cIdConce01=C.cIdConce01 WHERE A.cCodigoC01='" & wb.SHEETS(5).cells(i, 3).value & "' AND YEAR(D.cFecha)=" & txtEjercicio.Text & " AND MONTH(D.cFecha)=" & IntMes & " AND C.cNombreC01='Reparaciones'")
                wb.SHEETS(5).cells(i, 29).value = BuscarDblDatoCitra("SELECT SUM(cTotal) AS TOTAL FROM MGW10008 D INNER JOIN MGW10002 A ON D.cIdClien01=A.cIdClien01 INNER JOIN MGW10006 C ON D.cIdConce01=C.cIdConce01 WHERE A.cCodigoC01='" & wb.SHEETS(5).cells(i, 3).value & "' AND YEAR(D.cFecha)=" & txtEjercicio.Text & " AND MONTH(D.cFecha)=" & IntMes & " AND C.cNombreC01='Abastecimiento de llantas nuevas'")
                wb.SHEETS(5).cells(i, 31).value = BuscarDblDatoCitra("SELECT SUM(cTotal) AS TOTAL FROM MGW10008 D INNER JOIN MGW10002 A ON D.cIdClien01=A.cIdClien01 INNER JOIN MGW10006 C ON D.cIdConce01=C.cIdConce01 WHERE A.cCodigoC01='" & wb.SHEETS(5).cells(i, 3).value & "' AND YEAR(D.cFecha)=" & txtEjercicio.Text & " AND MONTH(D.cFecha)=" & IntMes & " AND C.cNombreC01='Abastecimiento de llantas vitalizadas'")
                wb.SHEETS(5).cells(i, 33).value = "=V" & i & "+W" & i & "+X" & i & "+Z" & i & "+AB" & i & "+AD" & i & "+AF" & i

                wb.SHEETS(5).cells(i, 35).value = "=S" & i & "-AG" & i

                wb.SHEETS(5).cells(i, 42).value = "=SUMA(AK" & i & ":AO" & i & ")"

                wb.SHEETS(5).cells(i, 44).value = "=AI" & i & "-AP" & i

                wb.SHEETS(5).cells(i, 48).value = "=AR" & i & "-AT" & i

                wb.SHEETS(5).cells(i, 59).value = "=SUMA(AX" & i & ":BF" & i & ")"

                wb.SHEETS(5).cells(i, 61).value = "=AV" & i & "-BG" & i

                wb.SHEETS(5).cells(i, 65).value = "=BI" & i & "-BK" & i

                wb.SHEETS(5).cells(i, 69).value = "=BM" & i & "-BO" & i

            End If
        Next

        wb.SHEETS(5).cells(1, 3).value = BusesAUU + 6
        wb.SHEETS(5).cells(2, 3).value = BusesAUS - 6
        wb.SHEETS(5).cells(3, 3).value = BusesACG
        wb.SHEETS(5).cells(4, 3).value = BusesSPT
        wb.SHEETS(5).cells(5, 3).value = BusesASP
        wb.SHEETS(5).cells(6, 3).value = BusesLCB
        wb.SHEETS(5).cells(7, 3).value = "=SUMA(C1:C6)"

        wb.SHEETS(5).cells(1, 4).value = "=C1-6"
        wb.SHEETS(5).cells(2, 4).value = "=C2+6"

        wb.sheets(5).rows(8).rowheight = 44
        wb.sheets(5).rows(9).rowheight = 72
        wb.SHEETS(5).columns(2).columnwidth = 55
        wb.SHEETS(5).columns(3).columnwidth = 12
        wb.SHEETS(5).columns(4).columnwidth = 12
        wb.SHEETS(5).columns(5).columnwidth = 28
        wb.SHEETS(5).columns(6).columnwidth = 24
        wb.SHEETS(5).columns(7).columnwidth = 12
        wb.SHEETS(5).columns(8).columnwidth = 12
        wb.SHEETS(5).columns(9).columnwidth = 12
        wb.SHEETS(5).columns(10).columnwidth = 12
        wb.SHEETS(5).columns(11).columnwidth = 4
        wb.SHEETS(5).columns(12).columnwidth = 15
        wb.SHEETS(5).columns(13).columnwidth = 12
        wb.SHEETS(5).columns(14).columnwidth = 12
        wb.SHEETS(5).columns(15).columnwidth = 12
        wb.SHEETS(5).columns(16).columnwidth = 12
        wb.SHEETS(5).columns(17).columnwidth = 12
        wb.SHEETS(5).columns(18).columnwidth = 12
        wb.SHEETS(5).columns(19).columnwidth = 15
        wb.SHEETS(5).columns(20).columnwidth = 4
        wb.SHEETS(5).columns(21).columnwidth = 12
        wb.SHEETS(5).columns(22).columnwidth = 12
        wb.SHEETS(5).columns(23).columnwidth = 12
        wb.SHEETS(5).columns(24).columnwidth = 12
        wb.SHEETS(5).columns(25).columnwidth = 12
        wb.SHEETS(5).columns(26).columnwidth = 12
        wb.SHEETS(5).columns(27).columnwidth = 12
        wb.SHEETS(5).columns(28).columnwidth = 12
        wb.SHEETS(5).columns(29).columnwidth = 12
        wb.SHEETS(5).columns(30).columnwidth = 12
        wb.SHEETS(5).columns(31).columnwidth = 12
        wb.SHEETS(5).columns(32).columnwidth = 12
        wb.SHEETS(5).columns(33).columnwidth = 15
        wb.SHEETS(5).columns(34).columnwidth = 4
        wb.SHEETS(5).columns(35).columnwidth = 15
        wb.SHEETS(5).columns(36).columnwidth = 4
        wb.SHEETS(5).columns(37).columnwidth = 12
        wb.SHEETS(5).columns(38).columnwidth = 12
        wb.SHEETS(5).columns(39).columnwidth = 12
        wb.SHEETS(5).columns(40).columnwidth = 12
        wb.SHEETS(5).columns(41).columnwidth = 12
        wb.SHEETS(5).columns(42).columnwidth = 15
        wb.SHEETS(5).columns(43).columnwidth = 4
        wb.SHEETS(5).columns(44).columnwidth = 15
        wb.SHEETS(5).columns(45).columnwidth = 4
        wb.SHEETS(5).columns(46).columnwidth = 12
        wb.SHEETS(5).columns(47).columnwidth = 4
        wb.SHEETS(5).columns(48).columnwidth = 15
        wb.SHEETS(5).columns(49).columnwidth = 4
        wb.SHEETS(5).columns(50).columnwidth = 12
        wb.SHEETS(5).columns(51).columnwidth = 12
        wb.SHEETS(5).columns(52).columnwidth = 12
        wb.SHEETS(5).columns(53).columnwidth = 12
        wb.SHEETS(5).columns(54).columnwidth = 12
        wb.SHEETS(5).columns(55).columnwidth = 12
        wb.SHEETS(5).columns(56).columnwidth = 12
        wb.SHEETS(5).columns(57).columnwidth = 12
        wb.SHEETS(5).columns(58).columnwidth = 12
        wb.SHEETS(5).columns(59).columnwidth = 15
        wb.SHEETS(5).columns(60).columnwidth = 4
        wb.SHEETS(5).columns(61).columnwidth = 15
        wb.SHEETS(5).columns(62).columnwidth = 4
        wb.SHEETS(5).columns(63).columnwidth = 12
        wb.SHEETS(5).columns(64).columnwidth = 4
        wb.SHEETS(5).columns(65).columnwidth = 15
        wb.SHEETS(5).columns(66).columnwidth = 4
        wb.SHEETS(5).columns(67).columnwidth = 12
        wb.SHEETS(5).columns(68).columnwidth = 4
        wb.SHEETS(5).columns(69).columnwidth = 15

        wb.SHEETS(5).columns(19).font.bold = True
        wb.SHEETS(5).columns(33).font.bold = True
        wb.SHEETS(5).columns(35).font.bold = True
        wb.SHEETS(5).columns(42).font.bold = True
        wb.SHEETS(5).columns(44).font.bold = True
        wb.SHEETS(5).columns(48).font.bold = True
        wb.SHEETS(5).columns(59).font.bold = True
        wb.SHEETS(5).columns(61).font.bold = True
        wb.SHEETS(5).columns(65).font.bold = True
        wb.SHEETS(5).columns(69).font.bold = True

        wb.SHEETS(5).columns(7).NumberFormat = "#,##0"
        wb.SHEETS(5).columns(8).NumberFormat = "#,##0.00"
        wb.SHEETS(5).columns(9).NumberFormat = "#,##0.00"
        wb.SHEETS(5).columns(10).NumberFormat = "#,##0"

        For i = 12 To 69
            wb.SHEETS(5).columns(i).NumberFormat = "#,##0.00"
        Next
        wb.SHEETS(5).name = "RPA"

    End Sub
    Sub GastosComunesAdministracion()
        Dim rng As Integer = 2

        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(1).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(1).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(1).cells(rng, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(1).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(1).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(1).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(1).cells(rng, 2).value = "GASTOS DE ADMINISTRACIÓN"
        rng = rng + 2

        'AGREGA DEFINICIONES
        wb.SHEETS(1).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(1).cells(rng, 3).value = "ENERO"
        wb.SHEETS(1).cells(rng, 4).value = "FEBRERO"
        wb.SHEETS(1).cells(rng, 5).value = "MARZO"
        wb.SHEETS(1).cells(rng, 6).value = "ABRIL"
        wb.SHEETS(1).cells(rng, 7).value = "MAYO"
        wb.SHEETS(1).cells(rng, 8).value = "JUNIO"
        wb.SHEETS(1).cells(rng, 9).value = "JULIO"
        wb.SHEETS(1).cells(rng, 10).value = "AGOSTO"
        wb.SHEETS(1).cells(rng, 11).value = "SEPTIEMBRE"
        wb.SHEETS(1).cells(rng, 12).value = "OCTUBRE"
        wb.SHEETS(1).cells(rng, 13).value = "NOVIEMBRE"
        wb.SHEETS(1).cells(rng, 14).value = "DICIEMBRE"
        wb.SHEETS(1).cells(rng, 15).value = "ACUMULADO"

        For I = 2 To 15
            wb.SHEETS(1).cells(rng, I).font.bold = True
            wb.SHEETS(1).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(1).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(1).CELLS(rng, I).WrapText = True
            wb.SHEETS(1).CELLS(rng, I).Orientation = 0
            wb.SHEETS(1).CELLS(rng, I).AddIndent = False
            wb.SHEETS(1).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(1).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(1).CELLS(rng, I).MergeCells = False
            wb.SHEETS(1).CELLS(rng, I).ReadingOrder = -5002
        Next

        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(1).cells(9, 2).value = "Sueldos y Salarios"
        wb.SHEETS(1).cells(10, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(1).cells(11, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(1).cells(12, 2).value = "Honorarios y Asesorias"
        wb.SHEETS(1).cells(13, 2).value = "Gasolinas y Lubricantes"
        wb.SHEETS(1).cells(14, 2).value = "Agua, Luz y Telefono"
        wb.SHEETS(1).cells(15, 2).value = "Papeleria y Articulos de Oficina"
        wb.SHEETS(1).cells(16, 2).value = "Mantenimiento y Equipo de Trabajo"
        wb.SHEETS(1).cells(17, 2).value = "Mantenimiento Unidades Utilitarias"
        wb.SHEETS(1).cells(18, 2).value = "Articulos de Aseo y Limpieza"
        wb.SHEETS(1).cells(19, 2).value = "Herramientas y Materiales Diversos"
        wb.SHEETS(1).cells(20, 2).value = "Comisiones y Custodia de Valores"
        wb.SHEETS(1).cells(21, 2).value = "Reparaciones e Indemnizaciones a Terceros"
        wb.SHEETS(1).cells(22, 2).value = "Gruas y Pensiones"
        wb.SHEETS(1).cells(23, 2).value = "Multas e Infracciones"
        wb.SHEETS(1).cells(24, 2).value = "Gastos Menores"
        wb.SHEETS(1).cells(25, 2).value = "Gastos Comunes ACG"
        wb.SHEETS(1).cells(26, 2).value = "Gastos Comunes ASP"
        wb.SHEETS(1).cells(27, 2).value = "Gastos Comunes LCB"
        wb.SHEETS(1).cells(29, 2).value = "TOTAL DE GASTOS"
        wb.SHEETS(1).cells(31, 2).value = "SubTotal"

        Dim Letra As String = ""
        Select Case Col
            Case 3
                Letra = "C"
            Case 4
                Letra = "D"
            Case 5
                Letra = "E"
            Case 6
                Letra = "F"
            Case 7
                Letra = "G"
            Case 8
                Letra = "H"
            Case 9
                Letra = "I"
            Case 10
                Letra = "J"
            Case 11
                Letra = "K"
            Case 12
                Letra = "L"
            Case 13
                Letra = "M"
            Case 14
                Letra = "N"

        End Select

        lblStatus.Text = "Procesando Gastos de Administración"

        wb.SHEETS(1).cells(9, Col).value = CargosMenosAbonos(1001)
        wb.SHEETS(1).cells(10, Col).value = CargosMenosAbonos(1002)
        wb.SHEETS(1).cells(11, Col).value = CargosMenosAbonos(1003)
        wb.SHEETS(1).cells(12, Col).value = CargosMenosAbonos(1004)
        wb.SHEETS(1).cells(13, Col).value = CargosMenosAbonos(1005)
        wb.SHEETS(1).cells(14, Col).value = CargosMenosAbonos(1006)
        wb.SHEETS(1).cells(15, Col).value = CargosMenosAbonos(1007)
        wb.SHEETS(1).cells(16, Col).value = CargosMenosAbonos(1008)
        wb.SHEETS(1).cells(17, Col).value = CargosMenosAbonos(1009)
        wb.SHEETS(1).cells(18, Col).value = CargosMenosAbonos(1010)
        wb.SHEETS(1).cells(19, Col).value = CargosMenosAbonos(1011)
        wb.SHEETS(1).cells(20, Col).value = CargosMenosAbonos(1012)
        wb.SHEETS(1).cells(21, Col).value = CargosMenosAbonos(1013)
        wb.SHEETS(1).cells(22, Col).value = CargosMenosAbonos(1014)
        wb.SHEETS(1).cells(23, Col).value = CargosMenosAbonos(1015)
        wb.SHEETS(1).cells(24, Col).value = CargosMenosAbonos(1016)
        wb.SHEETS(1).cells(25, Col).value = CargosMenosAbonos(2401)
        wb.SHEETS(1).cells(26, Col).value = CargosMenosAbonos(2402)
        wb.SHEETS(1).cells(27, Col).value = CargosMenosAbonos(2403)

        wb.SHEETS(1).cells(29, 3).value = "=SUMA(C" & 9 & ":C" & 27 & ")"
        wb.SHEETS(1).cells(31, 3).value = "=SUMA(C" & 9 & ":C" & 24 & ")"
        wb.SHEETS(1).cells(29, 4).value = "=SUMA(D" & 9 & ":D" & 27 & ")"
        wb.SHEETS(1).cells(31, 4).value = "=SUMA(D" & 9 & ":D" & 24 & ")"
        wb.SHEETS(1).cells(29, 5).value = "=SUMA(E" & 9 & ":E" & 27 & ")"
        wb.SHEETS(1).cells(31, 5).value = "=SUMA(E" & 9 & ":E" & 24 & ")"
        wb.SHEETS(1).cells(29, 6).value = "=SUMA(F" & 9 & ":F" & 27 & ")"
        wb.SHEETS(1).cells(31, 6).value = "=SUMA(F" & 9 & ":F" & 24 & ")"
        wb.SHEETS(1).cells(29, 7).value = "=SUMA(G" & 9 & ":G" & 27 & ")"
        wb.SHEETS(1).cells(31, 7).value = "=SUMA(G" & 9 & ":G" & 24 & ")"
        wb.SHEETS(1).cells(29, 8).value = "=SUMA(H" & 9 & ":H" & 27 & ")"
        wb.SHEETS(1).cells(31, 8).value = "=SUMA(H" & 9 & ":H" & 24 & ")"
        wb.SHEETS(1).cells(29, 9).value = "=SUMA(I" & 9 & ":I" & 27 & ")"
        wb.SHEETS(1).cells(31, 9).value = "=SUMA(I" & 9 & ":I" & 24 & ")"
        wb.SHEETS(1).cells(29, 10).value = "=SUMA(J" & 9 & ":J" & 27 & ")"
        wb.SHEETS(1).cells(31, 10).value = "=SUMA(J" & 9 & ":J" & 24 & ")"
        wb.SHEETS(1).cells(29, 11).value = "=SUMA(K" & 9 & ":K" & 27 & ")"
        wb.SHEETS(1).cells(31, 11).value = "=SUMA(K" & 9 & ":K" & 24 & ")"
        wb.SHEETS(1).cells(29, 12).value = "=SUMA(L" & 9 & ":L" & 27 & ")"
        wb.SHEETS(1).cells(31, 12).value = "=SUMA(L" & 9 & ":L" & 24 & ")"
        wb.SHEETS(1).cells(29, 13).value = "=SUMA(M" & 9 & ":M" & 27 & ")"
        wb.SHEETS(1).cells(31, 13).value = "=SUMA(M" & 9 & ":M" & 24 & ")"
        wb.SHEETS(1).cells(29, 14).value = "=SUMA(N" & 9 & ":N" & 27 & ")"
        wb.SHEETS(1).cells(31, 14).value = "=SUMA(N" & 9 & ":N" & 24 & ")"

        wb.SHEETS(1).cells(9, 15).value = "=SUMA(C9:N9)"
        wb.SHEETS(1).cells(10, 15).value = "=SUMA(C10:N10)"
        wb.SHEETS(1).cells(11, 15).value = "=SUMA(C11:N11)"
        wb.SHEETS(1).cells(12, 15).value = "=SUMA(C12:N12)"
        wb.SHEETS(1).cells(13, 15).value = "=SUMA(C13:N13)"
        wb.SHEETS(1).cells(14, 15).value = "=SUMA(C14:N14)"
        wb.SHEETS(1).cells(15, 15).value = "=SUMA(C15:N15)"
        wb.SHEETS(1).cells(16, 15).value = "=SUMA(C16:N16)"
        wb.SHEETS(1).cells(17, 15).value = "=SUMA(C17:N17)"
        wb.SHEETS(1).cells(18, 15).value = "=SUMA(C18:N18)"
        wb.SHEETS(1).cells(19, 15).value = "=SUMA(C19:N19)"
        wb.SHEETS(1).cells(20, 15).value = "=SUMA(C20:N20)"
        wb.SHEETS(1).cells(21, 15).value = "=SUMA(C21:N21)"
        wb.SHEETS(1).cells(22, 15).value = "=SUMA(C22:N22)"
        wb.SHEETS(1).cells(23, 15).value = "=SUMA(C23:N23)"
        wb.SHEETS(1).cells(24, 15).value = "=SUMA(C24:N24)"
        wb.SHEETS(1).cells(25, 15).value = "=SUMA(C25:N25)"
        wb.SHEETS(1).cells(26, 15).value = "=SUMA(C26:N26)"
        wb.SHEETS(1).cells(27, 15).value = "=SUMA(C27:N27)"
        wb.SHEETS(1).cells(29, 15).value = "=SUMA(C29:N29)"
        wb.SHEETS(1).cells(31, 15).value = "=SUMA(C31:N31)"

        For I = Col + 1 To 14
            For J = 9 To 27
                wb.SHEETS(1).cells(J, I).value = 0
            Next
        Next

        wb.SHEETS(1).columns(2).columnwidth = 44
        For i = 3 To 15
            wb.SHEETS(1).columns(i).columnwidth = 12
            wb.SHEETS(1).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(1).name = "Gastos Comunes Administracion"

    End Sub
    Sub GastosComunesSeguroInterno()
        Dim rng As Integer = 2
       
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))
        wb.SHEETS(4).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(4).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(4).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(4).cells(rng, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(4).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(4).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(4).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(4).cells(rng, 2).value = "GASTOS DE SEGURO INTERNO"
        rng = rng + 2

        'AGREGA DEFINICIONES
        wb.SHEETS(4).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(4).cells(rng, 3).value = "ENERO"
        wb.SHEETS(4).cells(rng, 4).value = "FEBRERO"
        wb.SHEETS(4).cells(rng, 5).value = "MARZO"
        wb.SHEETS(4).cells(rng, 6).value = "ABRIL"
        wb.SHEETS(4).cells(rng, 7).value = "MAYO"
        wb.SHEETS(4).cells(rng, 8).value = "JUNIO"
        wb.SHEETS(4).cells(rng, 9).value = "JULIO"
        wb.SHEETS(4).cells(rng, 10).value = "AGOSTO"
        wb.SHEETS(4).cells(rng, 11).value = "SEPTIEMBRE"
        wb.SHEETS(4).cells(rng, 12).value = "OCTUBRE"
        wb.SHEETS(4).cells(rng, 13).value = "NOVIEMBRE"
        wb.SHEETS(4).cells(rng, 14).value = "DICIEMBRE"
        wb.SHEETS(4).cells(rng, 15).value = "ACUMULADO"

        For I = 2 To 15
            wb.SHEETS(4).cells(rng, I).font.bold = True
            wb.SHEETS(4).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(4).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(4).CELLS(rng, I).WrapText = True
            wb.SHEETS(4).CELLS(rng, I).Orientation = 0
            wb.SHEETS(4).CELLS(rng, I).AddIndent = False
            wb.SHEETS(4).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(4).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(4).CELLS(rng, I).MergeCells = False
            wb.SHEETS(4).CELLS(rng, I).ReadingOrder = -5002
        Next

        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(4).cells(9, 2).value = "Sueldos y Salarios"
        wb.SHEETS(4).cells(10, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(4).cells(11, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(4).cells(12, 2).value = "Honorarios y Asesorias"
        wb.SHEETS(4).cells(13, 2).value = "Gasolinas y Lubricantes"
        wb.SHEETS(4).cells(14, 2).value = "Agua, Luz y Telefono"
        wb.SHEETS(4).cells(15, 2).value = "Papeleria y Articulos de Oficina"
        wb.SHEETS(4).cells(16, 2).value = "Mantenimiento y Equipo de Trabajo"
        wb.SHEETS(4).cells(17, 2).value = "Mantenimiento Unidades Utilitarias"
        wb.SHEETS(4).cells(18, 2).value = "Articulos de Aseo y Limpieza"
        wb.SHEETS(4).cells(19, 2).value = "Herramientas y Materiales Diversos"
        wb.SHEETS(4).cells(20, 2).value = "Comisiones y Custodia de Valores"
        wb.SHEETS(4).cells(21, 2).value = "Reparaciones e Indemnizaciones a Terceros"
        wb.SHEETS(4).cells(22, 2).value = "Gruas y Pensiones"
        wb.SHEETS(4).cells(23, 2).value = "Multas e Infracciones"
        wb.SHEETS(4).cells(24, 2).value = "Gastos Menores"
        wb.SHEETS(4).cells(25, 2).value = "Gastos Comunes ACG"
        wb.SHEETS(4).cells(26, 2).value = "Gastos Comunes ASP"
        wb.SHEETS(4).cells(27, 2).value = "Gastos Comunes LCB"
        wb.SHEETS(4).cells(29, 2).value = "TOTAL DE GASTOS"
        wb.SHEETS(4).cells(31, 2).value = "SubTotal"

        Dim Letra As String = ""
        Select Case Col
            Case 3
                Letra = "C"
            Case 4
                Letra = "D"
            Case 5
                Letra = "E"
            Case 6
                Letra = "F"
            Case 7
                Letra = "G"
            Case 8
                Letra = "H"
            Case 9
                Letra = "I"
            Case 10
                Letra = "J"
            Case 11
                Letra = "K"
            Case 12
                Letra = "L"
            Case 13
                Letra = "M"
            Case 14
                Letra = "N"

        End Select

        lblStatus.Text = "Procesando Gastos de Seguro Interno"

        wb.SHEETS(4).cells(9, Col).value = CargosMenosAbonos(901)
        wb.SHEETS(4).cells(10, Col).value = CargosMenosAbonos(902)
        wb.SHEETS(4).cells(11, Col).value = CargosMenosAbonos(903)
        wb.SHEETS(4).cells(12, Col).value = CargosMenosAbonos(904)
        wb.SHEETS(4).cells(13, Col).value = CargosMenosAbonos(905)
        wb.SHEETS(4).cells(14, Col).value = CargosMenosAbonos(906)
        wb.SHEETS(4).cells(15, Col).value = CargosMenosAbonos(907)
        wb.SHEETS(4).cells(16, Col).value = CargosMenosAbonos(908)
        wb.SHEETS(4).cells(17, Col).value = CargosMenosAbonos(909)
        wb.SHEETS(4).cells(18, Col).value = CargosMenosAbonos(910)
        wb.SHEETS(4).cells(19, Col).value = CargosMenosAbonos(911)
        wb.SHEETS(4).cells(20, Col).value = CargosMenosAbonos(912)
        wb.SHEETS(4).cells(21, Col).value = CargosMenosAbonos(913)
        wb.SHEETS(4).cells(22, Col).value = CargosMenosAbonos(914)
        wb.SHEETS(4).cells(23, Col).value = CargosMenosAbonos(915)
        wb.SHEETS(4).cells(24, Col).value = CargosMenosAbonos(916)
        wb.SHEETS(4).cells(25, Col).value = CargosMenosAbonos(2301)
        wb.SHEETS(4).cells(26, Col).value = CargosMenosAbonos(2302)
        wb.SHEETS(4).cells(27, Col).value = CargosMenosAbonos(2303)

        wb.SHEETS(4).cells(29, 3).value = "=SUMA(C" & 9 & ":C" & 27 & ")"
        wb.SHEETS(4).cells(31, 3).value = "=SUMA(C" & 9 & ":C" & 24 & ")"
        wb.SHEETS(4).cells(29, 4).value = "=SUMA(D" & 9 & ":D" & 27 & ")"
        wb.SHEETS(4).cells(31, 4).value = "=SUMA(D" & 9 & ":D" & 24 & ")"
        wb.SHEETS(4).cells(29, 5).value = "=SUMA(E" & 9 & ":E" & 27 & ")"
        wb.SHEETS(4).cells(31, 5).value = "=SUMA(E" & 9 & ":E" & 24 & ")"
        wb.SHEETS(4).cells(29, 6).value = "=SUMA(F" & 9 & ":F" & 27 & ")"
        wb.SHEETS(4).cells(31, 6).value = "=SUMA(F" & 9 & ":F" & 24 & ")"
        wb.SHEETS(4).cells(29, 7).value = "=SUMA(G" & 9 & ":G" & 27 & ")"
        wb.SHEETS(4).cells(31, 7).value = "=SUMA(G" & 9 & ":G" & 24 & ")"
        wb.SHEETS(4).cells(29, 8).value = "=SUMA(H" & 9 & ":H" & 27 & ")"
        wb.SHEETS(4).cells(31, 8).value = "=SUMA(H" & 9 & ":H" & 24 & ")"
        wb.SHEETS(4).cells(29, 9).value = "=SUMA(I" & 9 & ":I" & 27 & ")"
        wb.SHEETS(4).cells(31, 9).value = "=SUMA(I" & 9 & ":I" & 24 & ")"
        wb.SHEETS(4).cells(29, 10).value = "=SUMA(J" & 9 & ":J" & 27 & ")"
        wb.SHEETS(4).cells(31, 10).value = "=SUMA(J" & 9 & ":J" & 24 & ")"
        wb.SHEETS(4).cells(29, 11).value = "=SUMA(K" & 9 & ":K" & 27 & ")"
        wb.SHEETS(4).cells(31, 11).value = "=SUMA(K" & 9 & ":K" & 24 & ")"
        wb.SHEETS(4).cells(29, 12).value = "=SUMA(L" & 9 & ":L" & 27 & ")"
        wb.SHEETS(4).cells(31, 12).value = "=SUMA(L" & 9 & ":L" & 24 & ")"
        wb.SHEETS(4).cells(29, 13).value = "=SUMA(M" & 9 & ":M" & 27 & ")"
        wb.SHEETS(4).cells(31, 13).value = "=SUMA(M" & 9 & ":M" & 24 & ")"
        wb.SHEETS(4).cells(29, 14).value = "=SUMA(N" & 9 & ":N" & 27 & ")"
        wb.SHEETS(4).cells(31, 14).value = "=SUMA(N" & 9 & ":N" & 24 & ")"

        wb.SHEETS(4).cells(9, 15).value = "=SUMA(C9:N9)"
        wb.SHEETS(4).cells(10, 15).value = "=SUMA(C10:N10)"
        wb.SHEETS(4).cells(11, 15).value = "=SUMA(C11:N11)"
        wb.SHEETS(4).cells(12, 15).value = "=SUMA(C12:N12)"
        wb.SHEETS(4).cells(13, 15).value = "=SUMA(C13:N13)"
        wb.SHEETS(4).cells(14, 15).value = "=SUMA(C14:N14)"
        wb.SHEETS(4).cells(15, 15).value = "=SUMA(C15:N15)"
        wb.SHEETS(4).cells(16, 15).value = "=SUMA(C16:N16)"
        wb.SHEETS(4).cells(17, 15).value = "=SUMA(C17:N17)"
        wb.SHEETS(4).cells(18, 15).value = "=SUMA(C18:N18)"
        wb.SHEETS(4).cells(19, 15).value = "=SUMA(C19:N19)"
        wb.SHEETS(4).cells(20, 15).value = "=SUMA(C20:N20)"
        wb.SHEETS(4).cells(21, 15).value = "=SUMA(C21:N21)"
        wb.SHEETS(4).cells(22, 15).value = "=SUMA(C22:N22)"
        wb.SHEETS(4).cells(23, 15).value = "=SUMA(C23:N23)"
        wb.SHEETS(4).cells(24, 15).value = "=SUMA(C24:N24)"
        wb.SHEETS(4).cells(25, 15).value = "=SUMA(C25:N25)"
        wb.SHEETS(4).cells(26, 15).value = "=SUMA(C26:N26)"
        wb.SHEETS(4).cells(27, 15).value = "=SUMA(C27:N27)"
        wb.SHEETS(4).cells(29, 15).value = "=SUMA(C29:N29)"
        wb.SHEETS(4).cells(31, 15).value = "=SUMA(C31:N31)"

        For I = Col + 1 To 14
            For J = 9 To 27
                wb.SHEETS(4).cells(J, I).value = 0
            Next
        Next

        wb.SHEETS(4).columns(2).columnwidth = 44
        For i = 3 To 15
            wb.SHEETS(4).columns(i).columnwidth = 12
            wb.SHEETS(4).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(4).name = "Gastos Comunes Seguro Interno"
    End Sub
    Sub GastosComunesMantenimiento()
        Dim rng As Integer = 2
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))

        wb.SHEETS(3).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(3).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(3).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(3).cells(rng, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(3).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(3).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(3).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(3).cells(rng, 2).value = "GASTOS DE MANTENIMIENTO"
        rng = rng + 2

        'AGREGA DEFINICIONES
        wb.SHEETS(3).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(3).cells(rng, 3).value = "ENERO"
        wb.SHEETS(3).cells(rng, 4).value = "FEBRERO"
        wb.SHEETS(3).cells(rng, 5).value = "MARZO"
        wb.SHEETS(3).cells(rng, 6).value = "ABRIL"
        wb.SHEETS(3).cells(rng, 7).value = "MAYO"
        wb.SHEETS(3).cells(rng, 8).value = "JUNIO"
        wb.SHEETS(3).cells(rng, 9).value = "JULIO"
        wb.SHEETS(3).cells(rng, 10).value = "AGOSTO"
        wb.SHEETS(3).cells(rng, 11).value = "SEPTIEMBRE"
        wb.SHEETS(3).cells(rng, 12).value = "OCTUBRE"
        wb.SHEETS(3).cells(rng, 13).value = "NOVIEMBRE"
        wb.SHEETS(3).cells(rng, 14).value = "DICIEMBRE"
        wb.SHEETS(3).cells(rng, 15).value = "ACUMULADO"

        For I = 2 To 15
            wb.SHEETS(3).cells(rng, I).font.bold = True
            wb.SHEETS(3).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(3).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(3).CELLS(rng, I).WrapText = True
            wb.SHEETS(3).CELLS(rng, I).Orientation = 0
            wb.SHEETS(3).CELLS(rng, I).AddIndent = False
            wb.SHEETS(3).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(3).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(3).CELLS(rng, I).MergeCells = False
            wb.SHEETS(3).CELLS(rng, I).ReadingOrder = -5002
        Next

        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(3).cells(9, 2).value = "Sueldos y Salarios"
        wb.SHEETS(3).cells(10, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(3).cells(11, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(3).cells(12, 2).value = "Honorarios y Asesorias"
        wb.SHEETS(3).cells(13, 2).value = "Gasolinas y Lubricantes"
        wb.SHEETS(3).cells(14, 2).value = "Agua, Luz y Telefono"
        wb.SHEETS(3).cells(15, 2).value = "Papeleria y Articulos de Oficina"
        wb.SHEETS(3).cells(16, 2).value = "Mantenimiento y Equipo de Trabajo"
        wb.SHEETS(3).cells(17, 2).value = "Mantenimiento Unidades Utilitarias"
        wb.SHEETS(3).cells(18, 2).value = "Articulos de Aseo y Limpieza"
        wb.SHEETS(3).cells(19, 2).value = "Herramientas y Materiales Diversos"
        wb.SHEETS(3).cells(20, 2).value = "Comisiones y Custodia de Valores"
        wb.SHEETS(3).cells(21, 2).value = "Reparaciones e Indemnizaciones a Terceros"
        wb.SHEETS(3).cells(22, 2).value = "Gruas y Pensiones"
        wb.SHEETS(3).cells(23, 2).value = "Multas e Infracciones"
        wb.SHEETS(3).cells(24, 2).value = "Gastos Menores"
        wb.SHEETS(3).cells(25, 2).value = "Gastos Comunes ACG"
        wb.SHEETS(3).cells(26, 2).value = "Gastos Comunes ASP"
        wb.SHEETS(3).cells(27, 2).value = "Gastos Comunes LCB"
        wb.SHEETS(3).cells(29, 2).value = "TOTAL DE GASTOS"
        wb.SHEETS(3).cells(31, 2).value = "SubTotal"

        Dim Letra As String = ""
        Select Case Col
            Case 3
                Letra = "C"
            Case 4
                Letra = "D"
            Case 5
                Letra = "E"
            Case 6
                Letra = "F"
            Case 7
                Letra = "G"
            Case 8
                Letra = "H"
            Case 9
                Letra = "I"
            Case 10
                Letra = "J"
            Case 11
                Letra = "K"
            Case 12
                Letra = "L"
            Case 13
                Letra = "M"
            Case 14
                Letra = "N"

        End Select

        lblStatus.Text = "Procesando Gastos de Mantenimiento"

        wb.SHEETS(3).cells(9, Col).value = CargosMenosAbonos(701)
        wb.SHEETS(3).cells(10, Col).value = CargosMenosAbonos(702)
        wb.SHEETS(3).cells(11, Col).value = CargosMenosAbonos(703)
        wb.SHEETS(3).cells(12, Col).value = CargosMenosAbonos(704)
        wb.SHEETS(3).cells(13, Col).value = CargosMenosAbonos(705)
        wb.SHEETS(3).cells(14, Col).value = CargosMenosAbonos(706)
        wb.SHEETS(3).cells(15, Col).value = CargosMenosAbonos(707)
        wb.SHEETS(3).cells(16, Col).value = CargosMenosAbonos(708)
        wb.SHEETS(3).cells(17, Col).value = CargosMenosAbonos(709)
        wb.SHEETS(3).cells(18, Col).value = CargosMenosAbonos(710)
        wb.SHEETS(3).cells(19, Col).value = CargosMenosAbonos(711)
        wb.SHEETS(3).cells(20, Col).value = CargosMenosAbonos(712)
        wb.SHEETS(3).cells(21, Col).value = CargosMenosAbonos(713)
        wb.SHEETS(3).cells(22, Col).value = CargosMenosAbonos(714)
        wb.SHEETS(3).cells(23, Col).value = CargosMenosAbonos(715)
        wb.SHEETS(3).cells(24, Col).value = CargosMenosAbonos(716)
        wb.SHEETS(3).cells(25, Col).value = CargosMenosAbonos(2101)
        wb.SHEETS(3).cells(26, Col).value = CargosMenosAbonos(2102)
        wb.SHEETS(3).cells(27, Col).value = CargosMenosAbonos(2103)

        wb.SHEETS(3).cells(29, 3).value = "=SUMA(C" & 9 & ":C" & 27 & ")"
        wb.SHEETS(3).cells(31, 3).value = "=SUMA(C" & 9 & ":C" & 24 & ")"
        wb.SHEETS(3).cells(29, 4).value = "=SUMA(D" & 9 & ":D" & 27 & ")"
        wb.SHEETS(3).cells(31, 4).value = "=SUMA(D" & 9 & ":D" & 24 & ")"
        wb.SHEETS(3).cells(29, 5).value = "=SUMA(E" & 9 & ":E" & 27 & ")"
        wb.SHEETS(3).cells(31, 5).value = "=SUMA(E" & 9 & ":E" & 24 & ")"
        wb.SHEETS(3).cells(29, 6).value = "=SUMA(F" & 9 & ":F" & 27 & ")"
        wb.SHEETS(3).cells(31, 6).value = "=SUMA(F" & 9 & ":F" & 24 & ")"
        wb.SHEETS(3).cells(29, 7).value = "=SUMA(G" & 9 & ":G" & 27 & ")"
        wb.SHEETS(3).cells(31, 7).value = "=SUMA(G" & 9 & ":G" & 24 & ")"
        wb.SHEETS(3).cells(29, 8).value = "=SUMA(H" & 9 & ":H" & 27 & ")"
        wb.SHEETS(3).cells(31, 8).value = "=SUMA(H" & 9 & ":H" & 24 & ")"
        wb.SHEETS(3).cells(29, 9).value = "=SUMA(I" & 9 & ":I" & 27 & ")"
        wb.SHEETS(3).cells(31, 9).value = "=SUMA(I" & 9 & ":I" & 24 & ")"
        wb.SHEETS(3).cells(29, 10).value = "=SUMA(J" & 9 & ":J" & 27 & ")"
        wb.SHEETS(3).cells(31, 10).value = "=SUMA(J" & 9 & ":J" & 24 & ")"
        wb.SHEETS(3).cells(29, 11).value = "=SUMA(K" & 9 & ":K" & 27 & ")"
        wb.SHEETS(3).cells(31, 11).value = "=SUMA(K" & 9 & ":K" & 24 & ")"
        wb.SHEETS(3).cells(29, 12).value = "=SUMA(L" & 9 & ":L" & 27 & ")"
        wb.SHEETS(3).cells(31, 12).value = "=SUMA(L" & 9 & ":L" & 24 & ")"
        wb.SHEETS(3).cells(29, 13).value = "=SUMA(M" & 9 & ":M" & 27 & ")"
        wb.SHEETS(3).cells(31, 13).value = "=SUMA(M" & 9 & ":M" & 24 & ")"
        wb.SHEETS(3).cells(29, 14).value = "=SUMA(N" & 9 & ":N" & 27 & ")"
        wb.SHEETS(3).cells(31, 14).value = "=SUMA(N" & 9 & ":N" & 24 & ")"

        wb.SHEETS(3).cells(9, 15).value = "=SUMA(C9:N9)"
        wb.SHEETS(3).cells(10, 15).value = "=SUMA(C10:N10)"
        wb.SHEETS(3).cells(11, 15).value = "=SUMA(C11:N11)"
        wb.SHEETS(3).cells(12, 15).value = "=SUMA(C12:N12)"
        wb.SHEETS(3).cells(13, 15).value = "=SUMA(C13:N13)"
        wb.SHEETS(3).cells(14, 15).value = "=SUMA(C14:N14)"
        wb.SHEETS(3).cells(15, 15).value = "=SUMA(C15:N15)"
        wb.SHEETS(3).cells(16, 15).value = "=SUMA(C16:N16)"
        wb.SHEETS(3).cells(17, 15).value = "=SUMA(C17:N17)"
        wb.SHEETS(3).cells(18, 15).value = "=SUMA(C18:N18)"
        wb.SHEETS(3).cells(19, 15).value = "=SUMA(C19:N19)"
        wb.SHEETS(3).cells(20, 15).value = "=SUMA(C20:N20)"
        wb.SHEETS(3).cells(21, 15).value = "=SUMA(C21:N21)"
        wb.SHEETS(3).cells(22, 15).value = "=SUMA(C22:N22)"
        wb.SHEETS(3).cells(23, 15).value = "=SUMA(C23:N23)"
        wb.SHEETS(3).cells(24, 15).value = "=SUMA(C24:N24)"
        wb.SHEETS(3).cells(25, 15).value = "=SUMA(C25:N25)"
        wb.SHEETS(3).cells(26, 15).value = "=SUMA(C26:N26)"
        wb.SHEETS(3).cells(27, 15).value = "=SUMA(C27:N27)"
        wb.SHEETS(3).cells(29, 15).value = "=SUMA(C29:N29)"
        wb.SHEETS(3).cells(31, 15).value = "=SUMA(C31:N31)"

        For I = Col + 1 To 14
            For J = 9 To 27
                wb.SHEETS(3).cells(J, I).value = 0
            Next
        Next

        wb.SHEETS(3).columns(2).columnwidth = 44
        For i = 3 To 15
            wb.SHEETS(3).columns(i).columnwidth = 12
            wb.SHEETS(3).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(3).name = "Gastos Comunes Mantenimiento"
    End Sub
    Sub GastosComunesOperacion()
        Dim rng As Integer = 2
        xl.Sheets.Add(After:=xl.Sheets(xl.Sheets.Count))

        wb.SHEETS(2).select()
        xl.activewindow.displaygridlines = False
        wb = xl.activeworkbook

        Dim Col As Integer = NumColumna(lstMeses.Text)
        wb.SHEETS(2).CELLS.FONT.NAME = "Arial"
        wb.SHEETS(2).CELLS.FONT.size = 10

        'AGREGA ENCABEZADOS
        wb.SHEETS(2).cells(rng, 2).value = "CONSORCIO OPTRA"
        wb.SHEETS(2).cells(rng, 2).FONT.SIZE = 14

        rng = rng + 1

        wb.SHEETS(2).cells(rng, 2).value = "INFORME ECONOMICO CORRESPONDIENTE A " & UCase(lstMeses.Text) & " " & txtEjercicio.Text
        wb.SHEETS(2).cells(rng, 2).FONT.SIZE = 12
        rng = rng + 1
        wb.SHEETS(2).cells(rng, 2).value = "GASTOS DE OPERACIÓN"
        rng = rng + 2

        'AGREGA DEFINICIONES
        wb.SHEETS(2).cells(rng, 2).value = "CONCEPTO"
        wb.SHEETS(2).cells(rng, 3).value = "ENERO"
        wb.SHEETS(2).cells(rng, 4).value = "FEBRERO"
        wb.SHEETS(2).cells(rng, 5).value = "MARZO"
        wb.SHEETS(2).cells(rng, 6).value = "ABRIL"
        wb.SHEETS(2).cells(rng, 7).value = "MAYO"
        wb.SHEETS(2).cells(rng, 8).value = "JUNIO"
        wb.SHEETS(2).cells(rng, 9).value = "JULIO"
        wb.SHEETS(2).cells(rng, 10).value = "AGOSTO"
        wb.SHEETS(2).cells(rng, 11).value = "SEPTIEMBRE"
        wb.SHEETS(2).cells(rng, 12).value = "OCTUBRE"
        wb.SHEETS(2).cells(rng, 13).value = "NOVIEMBRE"
        wb.SHEETS(2).cells(rng, 14).value = "DICIEMBRE"
        wb.SHEETS(2).cells(rng, 15).value = "ACUMULADO"

        For I = 2 To 15
            wb.SHEETS(2).cells(rng, I).font.bold = True
            wb.SHEETS(2).CELLS(rng, I).HorizontalAlignment = -4108
            wb.SHEETS(2).CELLS(rng, I).VerticalAlignment = -4108
            wb.SHEETS(2).CELLS(rng, I).WrapText = True
            wb.SHEETS(2).CELLS(rng, I).Orientation = 0
            wb.SHEETS(2).CELLS(rng, I).AddIndent = False
            wb.SHEETS(2).CELLS(rng, I).IndentLevel = 0
            wb.SHEETS(2).CELLS(rng, I).ShrinkToFit = False
            wb.SHEETS(2).CELLS(rng, I).MergeCells = False
            wb.SHEETS(2).CELLS(rng, I).ReadingOrder = -5002
        Next

        rng = rng + 1

        'AGREGA LISTA DE GASTOS
        wb.SHEETS(2).cells(9, 2).value = "Sueldos y Salarios"
        wb.SHEETS(2).cells(10, 2).value = "Cuotas IMSS, SAR e INFONAVIT"
        wb.SHEETS(2).cells(11, 2).value = "Impuestos y Derechos Estatales y Municipales"
        wb.SHEETS(2).cells(12, 2).value = "Honorarios y Asesorias"
        wb.SHEETS(2).cells(13, 2).value = "Gasolinas y Lubricantes"
        wb.SHEETS(2).cells(14, 2).value = "Agua, Luz y Telefono"
        wb.SHEETS(2).cells(15, 2).value = "Papeleria y Articulos de Oficina"
        wb.SHEETS(2).cells(16, 2).value = "Mantenimiento y Equipo de Trabajo"
        wb.SHEETS(2).cells(17, 2).value = "Mantenimiento Unidades Utilitarias"
        wb.SHEETS(2).cells(18, 2).value = "Articulos de Aseo y Limpieza"
        wb.SHEETS(2).cells(19, 2).value = "Herramientas y Materiales Diversos"
        wb.SHEETS(2).cells(20, 2).value = "Comisiones y Custodia de Valores"
        wb.SHEETS(2).cells(21, 2).value = "Reparaciones e Indemnizaciones a Terceros"
        wb.SHEETS(2).cells(22, 2).value = "Gruas y Pensiones"
        wb.SHEETS(2).cells(23, 2).value = "Multas e Infracciones"
        wb.SHEETS(2).cells(24, 2).value = "Gastos Menores"
        wb.SHEETS(2).cells(25, 2).value = "Gastos Comunes ACG"
        wb.SHEETS(2).cells(26, 2).value = "Gastos Comunes ASP"
        wb.SHEETS(2).cells(27, 2).value = "Gastos Comunes LCB"
        wb.SHEETS(2).cells(29, 2).value = "TOTAL DE GASTOS"
        wb.SHEETS(2).cells(31, 2).value = "SubTotal"

        Dim Letra As String = ""
        Select Case Col
            Case 3
                Letra = "C"
            Case 4
                Letra = "D"
            Case 5
                Letra = "E"
            Case 6
                Letra = "F"
            Case 7
                Letra = "G"
            Case 8
                Letra = "H"
            Case 9
                Letra = "I"
            Case 10
                Letra = "J"
            Case 11
                Letra = "K"
            Case 12
                Letra = "L"
            Case 13
                Letra = "M"
            Case 14
                Letra = "N"

        End Select

        lblStatus.Text = "Procesando Gastos de Operación"

        wb.SHEETS(2).cells(9, Col).value = CargosMenosAbonos(801)
        wb.SHEETS(2).cells(10, Col).value = CargosMenosAbonos(802)
        wb.SHEETS(2).cells(11, Col).value = CargosMenosAbonos(803)
        wb.SHEETS(2).cells(12, Col).value = CargosMenosAbonos(804)
        wb.SHEETS(2).cells(13, Col).value = CargosMenosAbonos(805)
        wb.SHEETS(2).cells(14, Col).value = CargosMenosAbonos(806)
        wb.SHEETS(2).cells(15, Col).value = CargosMenosAbonos(807)
        wb.SHEETS(2).cells(16, Col).value = CargosMenosAbonos(808)
        wb.SHEETS(2).cells(17, Col).value = CargosMenosAbonos(809)
        wb.SHEETS(2).cells(18, Col).value = CargosMenosAbonos(810)
        wb.SHEETS(2).cells(19, Col).value = CargosMenosAbonos(811)
        wb.SHEETS(2).cells(20, Col).value = CargosMenosAbonos(812)
        wb.SHEETS(2).cells(21, Col).value = CargosMenosAbonos(813)
        wb.SHEETS(2).cells(22, Col).value = CargosMenosAbonos(814)
        wb.SHEETS(2).cells(23, Col).value = CargosMenosAbonos(815)
        wb.SHEETS(2).cells(24, Col).value = CargosMenosAbonos(816)
        wb.SHEETS(2).cells(25, Col).value = CargosMenosAbonos(2201)
        wb.SHEETS(2).cells(26, Col).value = CargosMenosAbonos(2202)
        wb.SHEETS(2).cells(27, Col).value = CargosMenosAbonos(2203)

        wb.SHEETS(2).cells(29, 3).value = "=SUMA(C" & 9 & ":C" & 27 & ")"
        wb.SHEETS(2).cells(31, 3).value = "=SUMA(C" & 9 & ":C" & 24 & ")"
        wb.SHEETS(2).cells(29, 4).value = "=SUMA(D" & 9 & ":D" & 27 & ")"
        wb.SHEETS(2).cells(31, 4).value = "=SUMA(D" & 9 & ":D" & 24 & ")"
        wb.SHEETS(2).cells(29, 5).value = "=SUMA(E" & 9 & ":E" & 27 & ")"
        wb.SHEETS(2).cells(31, 5).value = "=SUMA(E" & 9 & ":E" & 24 & ")"
        wb.SHEETS(2).cells(29, 6).value = "=SUMA(F" & 9 & ":F" & 27 & ")"
        wb.SHEETS(2).cells(31, 6).value = "=SUMA(F" & 9 & ":F" & 24 & ")"
        wb.SHEETS(2).cells(29, 7).value = "=SUMA(G" & 9 & ":G" & 27 & ")"
        wb.SHEETS(2).cells(31, 7).value = "=SUMA(G" & 9 & ":G" & 24 & ")"
        wb.SHEETS(2).cells(29, 8).value = "=SUMA(H" & 9 & ":H" & 27 & ")"
        wb.SHEETS(2).cells(31, 8).value = "=SUMA(H" & 9 & ":H" & 24 & ")"
        wb.SHEETS(2).cells(29, 9).value = "=SUMA(I" & 9 & ":I" & 27 & ")"
        wb.SHEETS(2).cells(31, 9).value = "=SUMA(I" & 9 & ":I" & 24 & ")"
        wb.SHEETS(2).cells(29, 10).value = "=SUMA(J" & 9 & ":J" & 27 & ")"
        wb.SHEETS(2).cells(31, 10).value = "=SUMA(J" & 9 & ":J" & 24 & ")"
        wb.SHEETS(2).cells(29, 11).value = "=SUMA(K" & 9 & ":K" & 27 & ")"
        wb.SHEETS(2).cells(31, 11).value = "=SUMA(K" & 9 & ":K" & 24 & ")"
        wb.SHEETS(2).cells(29, 12).value = "=SUMA(L" & 9 & ":L" & 27 & ")"
        wb.SHEETS(2).cells(31, 12).value = "=SUMA(L" & 9 & ":L" & 24 & ")"
        wb.SHEETS(2).cells(29, 13).value = "=SUMA(M" & 9 & ":M" & 27 & ")"
        wb.SHEETS(2).cells(31, 13).value = "=SUMA(M" & 9 & ":M" & 24 & ")"
        wb.SHEETS(2).cells(29, 14).value = "=SUMA(N" & 9 & ":N" & 27 & ")"
        wb.SHEETS(2).cells(31, 14).value = "=SUMA(N" & 9 & ":N" & 24 & ")"

        wb.SHEETS(2).cells(9, 15).value = "=SUMA(C9:N9)"
        wb.SHEETS(2).cells(10, 15).value = "=SUMA(C10:N10)"
        wb.SHEETS(2).cells(11, 15).value = "=SUMA(C11:N11)"
        wb.SHEETS(2).cells(12, 15).value = "=SUMA(C12:N12)"
        wb.SHEETS(2).cells(13, 15).value = "=SUMA(C13:N13)"
        wb.SHEETS(2).cells(14, 15).value = "=SUMA(C14:N14)"
        wb.SHEETS(2).cells(15, 15).value = "=SUMA(C15:N15)"
        wb.SHEETS(2).cells(16, 15).value = "=SUMA(C16:N16)"
        wb.SHEETS(2).cells(17, 15).value = "=SUMA(C17:N17)"
        wb.SHEETS(2).cells(18, 15).value = "=SUMA(C18:N18)"
        wb.SHEETS(2).cells(19, 15).value = "=SUMA(C19:N19)"
        wb.SHEETS(2).cells(20, 15).value = "=SUMA(C20:N20)"
        wb.SHEETS(2).cells(21, 15).value = "=SUMA(C21:N21)"
        wb.SHEETS(2).cells(22, 15).value = "=SUMA(C22:N22)"
        wb.SHEETS(2).cells(23, 15).value = "=SUMA(C23:N23)"
        wb.SHEETS(2).cells(24, 15).value = "=SUMA(C24:N24)"
        wb.SHEETS(2).cells(25, 15).value = "=SUMA(C25:N25)"
        wb.SHEETS(2).cells(26, 15).value = "=SUMA(C26:N26)"
        wb.SHEETS(2).cells(27, 15).value = "=SUMA(C27:N27)"
        wb.SHEETS(2).cells(29, 15).value = "=SUMA(C29:N29)"
        wb.SHEETS(2).cells(31, 15).value = "=SUMA(C31:N31)"

        For I = Col + 1 To 14
            For J = 9 To 27
                wb.SHEETS(2).cells(J, I).value = 0
            Next
        Next

        wb.SHEETS(2).cells(33, 2).value = "Impuestos y Derechos Estatales y Municipales ACG"
        wb.SHEETS(2).cells(34, 2).value = "Gastos Diversos de Operación ACG"
        wb.SHEETS(2).cells(35, 2).value = "Impuestos y Derechos Estatales y Municipales SPT"
        wb.SHEETS(2).cells(36, 2).value = "Gastos Diversos de Operación SPT"
        wb.SHEETS(2).cells(37, 2).value = "Impuestos y Derechos Estatales y Municipales AYT"
        wb.SHEETS(2).cells(38, 2).value = "Gastos Diversos de Operación AYT"
        wb.SHEETS(2).cells(39, 2).value = "Impuestos y Derechos Estatales y Municipales LCB"
        wb.SHEETS(2).cells(40, 2).value = "Gastos Diversos de Operación LCB"

        wb.SHEETS(2).cells(33, 15).value = "=SUMA(C33:N33)"
        wb.SHEETS(2).cells(34, 15).value = "=SUMA(C34:N34)"
        wb.SHEETS(2).cells(35, 15).value = "=SUMA(C35:N35)"
        wb.SHEETS(2).cells(36, 15).value = "=SUMA(C36:N36)"
        wb.SHEETS(2).cells(37, 15).value = "=SUMA(C37:N37)"
        wb.SHEETS(2).cells(38, 15).value = "=SUMA(C38:N38)"
        wb.SHEETS(2).cells(39, 15).value = "=SUMA(C39:N39)"
        wb.SHEETS(2).cells(40, 15).value = "=SUMA(C40:N40)"

       
        wb.SHEETS(2).cells(33, Col).value = AbonosMenosCargosEmpresa(1303, "ACG")
        wb.SHEETS(2).cells(34, Col).value = AbonosMenosCargosEmpresa(1304, "ACG")
        wb.SHEETS(2).cells(35, Col).value = AbonosMenosCargosEmpresa(1403, "ACG")
        wb.SHEETS(2).cells(36, Col).value = AbonosMenosCargosEmpresa(1404, "ACG")
        wb.SHEETS(2).cells(37, Col).value = AbonosMenosCargosEmpresa(1503, "ASP")
        wb.SHEETS(2).cells(38, Col).value = AbonosMenosCargosEmpresa(1504, "ASP")
        wb.SHEETS(2).cells(39, Col).value = AbonosMenosCargosEmpresa(1603, "LCB") + AbonosMenosCargosEmpresa(1603, "OBE")
        wb.SHEETS(2).cells(40, Col).value = AbonosMenosCargosEmpresa(1604, "LCB") + AbonosMenosCargosEmpresa(1604, "OBE")

        For I = Col + 1 To 14
            For J = 33 To 40
                wb.SHEETS(2).cells(J, I).value = 0
            Next
        Next

        wb.SHEETS(2).columns(2).columnwidth = 44
        For i = 3 To 15
            wb.SHEETS(2).columns(i).columnwidth = 12
            wb.SHEETS(2).columns(i).NumberFormat = "#,##0.00"
        Next

        wb.SHEETS(2).name = "Gastos Comunes Operacion"

    End Sub
    Function AbonosMenosCargosEmpresa(ByVal Clasificacion As Integer, ByVal Empresa As String) As Double
        Dim cnconn As New SqlConnection
        Dim cmdBuscar As New SqlCommand
        Dim cmdAsignar As New SqlCommand
        Dim rdBuscar As SqlDataReader

        Dim MesStr As String = lstMeses.Text
        Dim Periodo As Integer = 0

        Select Case MesStr
            Case "Enero"
                Periodo = 1
            Case "Febrero"
                Periodo = 2
            Case "Marzo"
                Periodo = 3
            Case "Abril"
                Periodo = 4
            Case "Mayo"
                Periodo = 5
            Case "Junio"
                Periodo = 6
            Case "Julio"
                Periodo = 7
            Case "Agosto"
                Periodo = 8
            Case "Septiembre"
                Periodo = 9
            Case "Octubre"
                Periodo = 10
            Case "Noviembre"
                Periodo = 11
            Case "Diciembre"
                Periodo = 12
        End Select

        cnconn.ConnectionString = CitraConnection
        cnconn.Open()
        cmdBuscar.Connection = cnconn
        cmdAsignar.Connection = cnconn

        Dim strSql As String = ""
        strSql = "SELECT Cargos, Abonos, C.cImpuestos " & _
                 " FROM CuboContables S " & _
                 " INNER JOIN CuentasContables C ON S.Cuenta=C.Cuenta AND S.Abreviacion=C.Abreviacion" & _
                 " WHERE S.Ejercicio=" & txtEjercicio.Text & _
                 " AND S.Periodo=" & Periodo & _
                 " AND C.cInforme=" & Clasificacion & _
                 " AND S.Abreviacion='" & Empresa & "'"


        cmdBuscar.CommandText = strSql
        rdBuscar = cmdBuscar.ExecuteReader

        Dim Cargos As Double = 0
        Dim Abonos As Double = 0
        Dim IVA As Integer
        Dim Saldo As Double = 0
        Dim Total As Double = 0

        Do While rdBuscar.Read()
            IVA = rdBuscar("cImpuestos")
            If IVA = 1 Then
                Cargos = rdBuscar("Cargos") * 1.16
                Abonos = rdBuscar("Abonos") * 1.16
            Else
                Cargos = rdBuscar("Cargos")
                Abonos = rdBuscar("Abonos")
            End If
            Saldo = Abonos - Cargos
            Total = Total + Saldo

        Loop

        Return Total

        cnconn.Dispose()
        cnconn.Close()
        SqlConnection.ClearAllPools()
    End Function
    Function AbonosMenosCargos(ByVal Clasificacion As Integer) As Double
        Dim cnconn As New SqlConnection
        Dim cmdBuscar As New SqlCommand
        Dim cmdAsignar As New SqlCommand
        Dim rdBuscar As SqlDataReader

        Dim MesStr As String = lstMeses.Text
        Dim Periodo As Integer = 0

        Select Case MesStr
            Case "Enero"
                Periodo = 1
            Case "Febrero"
                Periodo = 2
            Case "Marzo"
                Periodo = 3
            Case "Abril"
                Periodo = 4
            Case "Mayo"
                Periodo = 5
            Case "Junio"
                Periodo = 6
            Case "Julio"
                Periodo = 7
            Case "Agosto"
                Periodo = 8
            Case "Septiembre"
                Periodo = 9
            Case "Octubre"
                Periodo = 10
            Case "Noviembre"
                Periodo = 11
            Case "Diciembre"
                Periodo = 12
        End Select

        cnconn.ConnectionString = CitraConnection
        cnconn.Open()
        cmdBuscar.Connection = cnconn
        cmdAsignar.Connection = cnconn

        Dim strSql As String = ""
        strSql = "SELECT Cargos, Abonos, C.cImpuestos " & _
                 " FROM CuboContables S " & _
                 " INNER JOIN CuentasContables C ON S.Cuenta=C.Cuenta AND S.Abreviacion=C.Abreviacion" & _
                 " WHERE S.Ejercicio=" & txtEjercicio.Text & _
                 " AND S.Periodo=" & Periodo & _
                 " AND C.cInforme=" & Clasificacion



        cmdBuscar.CommandText = strSql
        rdBuscar = cmdBuscar.ExecuteReader

        Dim Cargos As Double = 0
        Dim Abonos As Double = 0
        Dim IVA As Integer
        Dim Saldo As Double = 0
        Dim Total As Double = 0

        Do While rdBuscar.Read()
            IVA = rdBuscar("cImpuestos")
            If IVA = 1 Then
                Cargos = rdBuscar("Cargos") * 1.16
                Abonos = rdBuscar("Abonos") * 1.16
            Else
                Cargos = rdBuscar("Cargos")
                Abonos = rdBuscar("Abonos")
            End If
            Saldo = Abonos - Cargos
            Total = Total + Saldo

        Loop

        Return Total
        cnconn.Dispose()
        cnconn.Close()
        SqlConnection.ClearAllPools()


    End Function
    Function TotalAbonos(ByVal Clasificacion As Integer) As Double
        Dim cnconn As New SqlConnection
        Dim cmdBuscar As New SqlCommand
        Dim cmdAsignar As New SqlCommand
        Dim rdBuscar As SqlDataReader

        Dim MesStr As String = lstMeses.Text
        Dim Periodo As Integer = 0

        Select Case MesStr
            Case "Enero"
                Periodo = 1
            Case "Febrero"
                Periodo = 2
            Case "Marzo"
                Periodo = 3
            Case "Abril"
                Periodo = 4
            Case "Mayo"
                Periodo = 5
            Case "Junio"
                Periodo = 6
            Case "Julio"
                Periodo = 7
            Case "Agosto"
                Periodo = 8
            Case "Septiembre"
                Periodo = 9
            Case "Octubre"
                Periodo = 10
            Case "Noviembre"
                Periodo = 11
            Case "Diciembre"
                Periodo = 12
        End Select

        cnconn.ConnectionString = CitraConnection
        cnconn.Open()
        cmdBuscar.Connection = cnconn
        cmdAsignar.Connection = cnconn

        Dim strSql As String = ""
        strSql = "SELECT Cargos, Abonos, C.cImpuestos " & _
                 " FROM CuboContables S " & _
                 " INNER JOIN CuentasContables C ON S.Cuenta=C.Cuenta AND S.Abreviacion=C.Abreviacion" & _
                 " WHERE S.Ejercicio=" & txtEjercicio.Text & _
                 " AND S.Periodo=" & Periodo & _
                 " AND C.cInforme=" & Clasificacion


        cmdBuscar.CommandText = strSql
        rdBuscar = cmdBuscar.ExecuteReader

        Dim Abonos As Double = 0
        Dim Total As Double = 0
        Dim IVA As Double = 0


        Do While rdBuscar.Read()
            IVA = rdBuscar("cImpuestos")
            If IVA = 1 Then
                Abonos = rdBuscar("Abonos") * 1.16
            Else
                Abonos = rdBuscar("Abonos")
            End If
            Total = Total + Abonos

        Loop

        Return Total
        cnconn.Dispose()
        cnconn.Close()
        SqlConnection.ClearAllPools()
    End Function
    Function TotalCargos(ByVal Clasificacion As Integer) As Double
        Dim cnconn As New SqlConnection
        Dim cmdBuscar As New SqlCommand
        Dim cmdAsignar As New SqlCommand
        Dim rdBuscar As SqlDataReader

        Dim MesStr As String = lstMeses.Text
        Dim Periodo As Integer = 0

        Select Case MesStr
            Case "Enero"
                Periodo = 1
            Case "Febrero"
                Periodo = 2
            Case "Marzo"
                Periodo = 3
            Case "Abril"
                Periodo = 4
            Case "Mayo"
                Periodo = 5
            Case "Junio"
                Periodo = 6
            Case "Julio"
                Periodo = 7
            Case "Agosto"
                Periodo = 8
            Case "Septiembre"
                Periodo = 9
            Case "Octubre"
                Periodo = 10
            Case "Noviembre"
                Periodo = 11
            Case "Diciembre"
                Periodo = 12
        End Select

        cnconn.ConnectionString = CitraConnection
        cnconn.Open()
        cmdBuscar.Connection = cnconn
        cmdAsignar.Connection = cnconn

        Dim strSql As String = ""
        strSql = "SELECT Cargos, Abonos, C.cImpuestos " & _
                 " FROM CuboContables S " & _
                 " INNER JOIN CuentasContables C ON S.Cuenta=C.Cuenta AND S.Abreviacion=C.Abreviacion" & _
                 " WHERE S.Ejercicio=" & txtEjercicio.Text & _
                 " AND S.Periodo=" & Periodo & _
                 " AND C.cInforme=" & Clasificacion


        cmdBuscar.CommandText = strSql
        rdBuscar = cmdBuscar.ExecuteReader

        Dim Cargos As Double = 0
        Dim IVA As Integer
        Dim Total As Double = 0

        Do While rdBuscar.Read()
            IVA = rdBuscar("cImpuestos")
            If IVA = 1 Then
                Cargos = rdBuscar("Cargos") * 1.16
            Else
                Cargos = rdBuscar("Cargos")
            End If
            Total = Total + Cargos

        Loop

        Return Total
        cnconn.Dispose()
        cnconn.Close()
        SqlConnection.ClearAllPools()

    End Function
    Function CargosMenosAbonos(ByVal Clasificacion As Integer) As Double
        Dim cnconn As New SqlConnection
        Dim cmdBuscar As New SqlCommand
        Dim cmdAsignar As New SqlCommand
        Dim rdBuscar As SqlDataReader

        Dim MesStr As String = lstMeses.Text
        Dim Periodo As Integer = 0

        Select Case MesStr
            Case "Enero"
                Periodo = 1
            Case "Febrero"
                Periodo = 2
            Case "Marzo"
                Periodo = 3
            Case "Abril"
                Periodo = 4
            Case "Mayo"
                Periodo = 5
            Case "Junio"
                Periodo = 6
            Case "Julio"
                Periodo = 7
            Case "Agosto"
                Periodo = 8
            Case "Septiembre"
                Periodo = 9
            Case "Octubre"
                Periodo = 10
            Case "Noviembre"
                Periodo = 11
            Case "Diciembre"
                Periodo = 12
        End Select

        cnconn.ConnectionString = CitraConnection
        cnconn.Open()
        cmdBuscar.Connection = cnconn
        cmdAsignar.Connection = cnconn

        Dim strSql As String = ""
        strSql = "SELECT Cargos, Abonos, C.cImpuestos " & _
                 " FROM CuboContables S " & _
                 " INNER JOIN CuentasContables C ON S.Cuenta=C.Cuenta AND S.Abreviacion=C.Abreviacion" & _
                 " WHERE S.Ejercicio=" & txtEjercicio.Text & _
                 " AND S.Periodo=" & Periodo & _
                 " AND C.cInforme=" & Clasificacion


        cmdBuscar.CommandText = strSql
        rdBuscar = cmdBuscar.ExecuteReader

        Dim Cargos As Double = 0
        Dim Abonos As Double = 0
        Dim IVA As Integer
        Dim Saldo As Double = 0
        Dim Total As Double = 0

        Do While rdBuscar.Read()
            IVA = rdBuscar("cImpuestos")
            If IVA = 1 Then
                Cargos = rdBuscar("Cargos") * 1.16
                Abonos = rdBuscar("Abonos") * 1.16
            Else
                Cargos = rdBuscar("Cargos")
                Abonos = rdBuscar("Abonos")
            End If
            Saldo = Cargos - Abonos
            Total = Total + Saldo

        Loop

        Return Total
        cnconn.Dispose()
        cnconn.Close()
        SqlConnection.ClearAllPools()

    End Function
    Function NumColumna(ByVal Mes As String) As Integer

        NumColumna = 0

        Select Case Mes
            Case "Enero"
                NumColumna = 3
            Case "Febrero"
                NumColumna = 4
            Case "Marzo"
                NumColumna = 5
            Case "Abril"
                NumColumna = 6
            Case "Mayo"
                NumColumna = 7
            Case "Junio"
                NumColumna = 8
            Case "Julio"
                NumColumna = 9
            Case "Agosto"
                NumColumna = 10
            Case "Septiembre"
                NumColumna = 11
            Case "Octubre"
                NumColumna = 12
            Case "Noviembre"
                NumColumna = 13
            Case "Diciembre"
                NumColumna = 14
        End Select

        Return NumColumna

    End Function

    Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
        CreaArchivoExcel()

        GastosComunesAdministracion()
        GastosComunesOperacion()
        GastosComunesMantenimiento()
        GastosComunesSeguroInterno()
        ResultadoPorAutobus()
        Ajustes()
        AjustaResultadoPorAutobus()

        ResultadosCoordinado()
        ResultadosEmpresa()
        ResultadosAUSLAPI()
        ResultadosLCBAPI()
        ResultadosUrbano()
        ResultadosRuta()
        ResultadosKmsCoord()
        ResultadosKmsEmpresa()
        ResultadosKmsAUSLAPI()



    End Sub

    Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
        Close()

    End Sub
End Class